Ecommerce Shopify WordPress Discussion

Woocommerce/WordPress: Simple Product Attribute Display

What I am trying to achieve: Enable ‘Simple Product’ pages to display ‘Attributes’ (exactly as Variable Product Attributes are shown) What I already know: I know that it can be done by creating a Variable Product with just one variation instead of a Single Product. I have used Variable Products before and I don’t want to create 1 additional ID for every single simple product. Why am I trying this: Weights shown on any product page is the shipping weight. I want to show the product actual weight and actual volume (eg 100ml). Volumes are not supported by default and I want a consistent/elegant way to show it to customers. Since I am already using attributes for Variable products, I can quickly reuse the same attribute values for Simple Products. What I don’t want to do: – Write volume in the Product header – Create variable products with 1 variation I am sure there are lots of people facing this issue and would like a good solution. I just need the Attribute values to be shown for Simple Products in the exact place as Variable Products. I can customize the css part. I am comfortable editing functions.php Can anyone help me please?
To add the attributes after title we need to hook to woocommerce_single_product_summary action. By default title is with priority of 5 add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); In your child theme functions.php file add the following. add_action( 'woocommerce_single_product_summary', 'show_attributes_after_title', 6 ); function show_attributes_after_title() { global $product; $pa_weight = $product->get_attribute( 'pa_weight' ); //Make sure this is your attribute $pa_volume = $product->get_attribute( 'pa_volume' ); //Make sure this is your attribute if($pa_weight): echo $pa_weight; endif; if($pa_volume): echo $pa_volume; endif; }

February 4, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.