This topic has 5 replies, 2 voices, and was last updated 3 years, 11 months ago ago by Rose Tyler
hello, i am trying to add the below simple attribute list on the single product page
on the functions.php in the child theme. but does not do anything.
//show attributes after summary in product single view
add_action('woocommerce_single_product_summary', function() {
global $product;
echo $product->list_attributes();
}, 25);
Hello,
According to your choice to use the Single Product Builder there is fully different structure of actions. Most of them are coming from XStore theme/XStore Core. So that default woocommerce actions will not work normally, because if they would then there could not be such customizable options to use for the builder.
If you need to add your custom actions for single product while you are using builder, please use next actions for that :
etheme_woocommerce_template_single_title
etheme_woocommerce_template_single_rating
etheme_woocommerce_template_single_price
etheme_woocommerce_template_single_excerpt
etheme_woocommerce_template_single_add_to_cart
etheme_woocommerce_template_single_meta
etheme_woocommerce_template_woocommerce_breadcrumb
woocommerce_share
etheme_woocommerce_template_single_sharing
etheme_woocommerce_show_product_images
etheme_woocommerce_output_product_data_tabs
etheme_woocommerce_output_upsell_products
etheme_woocommerce_output_cross_sells_products
etheme_woocommerce_output_related_products
etheme_product_single_size_guide
etheme_product_single_size_guide
etheme_product_single_button
etheme_product_single_widget_area_01
etheme_product_single_custom_html_01
etheme_product_single_custom_html_02
etheme_product_single_custom_html_03
etheme_product_single_additional_custom_block
etheme_product_single_product_description
etheme_product_single_wishlist
etheme_product_single_compare
You can use it as you did with default ones. Please, add code to your child-theme/functions.php
Example:
add_action('etheme_woocommerce_template_single_title', function() {
global $product;
echo $product->get_id();
});
Regards
By the way your code is deprecated since Woocommerce v.3.0
You should use smth like next code:
add_action('etheme_woocommerce_template_single_title', function() {
global $product;
wc_display_product_attributes($product);
}, 25);
Regards
thank you very much !
🙂
You’re welcome!
Would you mind to rate our product:
https://prnt.sc/d256m6
https://themeforest.net/downloads
That would be much appreciated 🙂
Regards
The issue related to '‘trying to add some extra code’' has been successfully resolved, and the topic is now closed for further responses