I would like to insert the attributes from all products to their short description, so the client can open a quickview and check this attributes.
I already tried this answer: Display specific product attribute values on archives category pages
Also this one: Woocommerce - Display single product attribute(s) with shortcodes in Frontend
And I wasn't able to make it work. I think it should be because WooCommerce got updated to version 3.0+
Does anyone know a way to make it?
Thanks
Update 3 ( Automation for simple products, WC compatibility )
Update For WooCommerce version 3.0+ only.
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
It should work now in WC 3.0+
Related to this Answer code: Display specific product attribute values on archives category pages
to build off of LoicTheAztec's answer:
His code only works if you have predefined the attributes in the WP backend under Products -> Attributes. If you work with individual (custom) product attributes that you set up on the product page, wc_get_product_terms() won't return anything. You can recognize predefined attributes by the "pa_" prefix, they are stored in the "woocommerce_attribute_taxonomies" table.
In order to show these individual attributes in the same way as LoicTheAztec suggested, use this code:
how i can show the attribute label with this code?
// Compatibility for WC 3+ and automation enhancements add_action( 'woocommerce_shop_loop_item_title', 'custom_attributes_display', 20 ); function custom_attributes_display(){ global $product;
}