Product Units in Product Listing Pages - by schnetzi

This topic has 6 replies, 2 voices, and was last updated 7 years, 1 months ago ago by Rose Tyler

  • Avatar: schnetzi
    schnetzi
    Participant
    September 28, 2017 at 09:09

    Dear Sir or Madam,

    is it possible to show the product units in the product listing pages?
    I would like to display it after the categories and before the product information text?

    Thank you very much in advance!
    Best regards
    Paul

    Please, contact administrator
    for this information.
    5 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 28, 2017 at 09:16

    Hello,

    Could you please provide a screenshot for better understanding?

    Regards

    Avatar: schnetzi
    schnetzi
    Participant
    September 28, 2017 at 11:44

    Thank you for your fast reply!

    In the following image you can see what I mean. I added the red box manually with a graphic software.
    Product in Listing with Product Unit

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 28, 2017 at 13:46

    There is no such possibility by default, but you may use this code:
    http://prntscr.com/gqqu6s > http://prntscr.com/gqqx76

    <?php 
         if ( $product->has_weight() && is_shop() ) {
           $weight = $product->get_weight();
           echo '<div class="product-meta product-weight-list"><span class="product-meta-label">Weight: </span>' . $weight . get_option('woocommerce_weight_unit') . '</div></br>';
         }
      ?>

    in legenda/woocommerce/content-product.php file
    to show http://prntscr.com/gqqlyi > http://prntscr.com/gqqmes.
    We recommend you to make changes in a child theme.

    Regards

    Avatar: schnetzi
    schnetzi
    Participant
    September 28, 2017 at 15:45

    Thanks for the tip,

    I added the meta-information in this code like so:
    code to add product-units to listing pages

    I am also hiding the tagged words with display: none.

    Thanks for your help

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 28, 2017 at 15:54

    You’re welcome!
    I am glad that you sorted out.

    Regards

  • Viewing 6 results - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.