Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #111358

    Raphael B
    Participant

    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=collections

    thanks

    raf

    #111472

    Kosher K
    Member

    Hi 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

    #111542

    Raphael B
    Participant

    That’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?

    #111595

    Kosher K
    Member

    Hi 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() or get_post_meta() to display specific data

    you can read more info from here ->
    http://codex.wordpress.org/Custom_Fields
    http://codex.wordpress.org/Function_Reference/get_post_meta

    Cheers

    #111652

    Raphael B
    Participant

    It’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

    #111736

    Mrinal
    Member

    Hi 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 ?