-
AuthorPosts
-
September 24, 2014 at 6:53 am #111358
Hi there,
I would like very much to know how can I display a product attribute (say the weight) in the product index page.here’s an URL to my dev site.
http://www.potopoto.be/secondome/?product_cat=collectionsthanks
raf
September 24, 2014 at 9:36 am #111472Hi Raphael,
Just add this code below in your child theme functions.php
add_action('woocommerce_after_shop_loop_item','woocommerce_weight_data'); function woocommerce_weight_data() { global $post, $product; echo $product->get_weight(); }
You can check for all the function for the Product Class data here -> http://docs.woothemes.com/wc-apidocs/class-WC_Product.html
Hope that helps
September 24, 2014 at 10:51 am #111542That’s perfect thank you, and what if I want to use an attribute that I created? (In this case I’ve created an attribute with the name of the designer), there is the get_attributes () class but I don’t know php well enough to use it, can you help?
September 24, 2014 at 12:20 pm #111595Hi Raphael,
I’m not sure how did you add additional data in your woocommerce product.
Can you please provide more information?
If you are adding the data using custom field, you can display it using
the_meta()
orget_post_meta()
to display specific datayou can read more info from here ->
http://codex.wordpress.org/Custom_Fields
http://codex.wordpress.org/Function_Reference/get_post_meta
Cheers
September 24, 2014 at 1:48 pm #111652It’s just a product attribute, like the color of a shirt, but in this case the product attribute is the Designer’s name. I’ve created the attribute “Designer” in the attribute menu, just under “Shipping Classes”, in the “Products” menu.
thanks
September 24, 2014 at 3:57 pm #111736Hi Raphael,
Thanks for the update.
We can provide limited support for WooCommerce plugin & it’s customization. Would you mind to ask this kind of special customization support to WooCommerce community here: http://wordpress.org/support/plugin/woocommerce ?
-
AuthorPosts