Display itemnumber/ sku underneath producttitle in product-listing

This topic has 9 replies, 4 voices, and was last updated 9 years, 4 months ago ago by Robert Hall

  • Avatar: peter4576
    peter4576
    Participant
    July 26, 2015 at 07:23

    Hi there

    My customer requests (demands!) to have SKU/ itemnumber displayed underneath the product-title in product-listing. SKU is very important to them as customers search them. But in same the search function works really bad because I dont have e.g. product type (e.g. radio/ battery) in product-title. Therefore this functionality is of great importance.

    Thanks

    Peter

    8 Answers
    Avatar: peter4576
    peter4576
    Participant
    July 26, 2015 at 07:40

    OK I found this code after long search:

    add_action( ‘woocommerce_after_shop_loop_item_title’, ‘shop_sku’ );
    function shop_sku(){
    global $product;
    echo ‘<span itemprop=”productID” class=”sku”>SKU: ‘ . $product->sku . ‘</span>’;
    }

    However, it acts really weird: It displays the 3 products correctly, but the rest of the product-listing places the sku in front of the button. How and why does it do that? And how can I make it look normal?

    Thanks

    Peter
    http://pmr.as/produkt-kategori/aplikationer/

    https://gofile.me/6lYKv/9DWIMpip

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    July 27, 2015 at 11:37

    Hello,

    Unfortunately I don’t see such issue:
    http://storage1.static.itmages.com/i/15/0727/h_1437993413_8085318_ef5c6be3d7.png
    Is your browser up to date?

    Best regards,
    Jack Richardson.

    Avatar: peter4576
    peter4576
    Participant
    July 27, 2015 at 21:41

    Did you try and search and check search results etc.? They act different on different pages. I too experienced some pages which it worked on…

    Avatar: Eva
    Eva Kemp
    Support staff
    July 28, 2015 at 09:38

    Hello,

    Could you please be more specific?
    What issues should we see on in search results?
    Please show us screenshots.

    Thank you.
    Regards,
    Eva Kemp.

    Avatar: peter4576
    peter4576
    Participant
    July 29, 2015 at 10:25

    Ok, it seems somewhat ok now. I have no idea why it screw up on me earlier…

    Any ways – I thought i had set the ECHO-text to be Varenr (itemnumber in Danish) instead of SKU, and this would return the Danish text. But that is not the case. How can I change it to Varenr. instead?

    Thanks
    Peter

    https://gofile.me/6lYKv/oGfxm8o1

    Avatar: Eva
    Eva Kemp
    Support staff
    July 29, 2015 at 12:11

    Hello,

    I’ve edited the code in child functions.php:
    echo '<span itemprop="productID" class="Varenr.:">SKU: '
    changed to
    echo '<span itemprop="productID" class="Varenr.:">Varenr: '

    Please check your pages now.

    Regards,
    Eva Kemp.

    Avatar: peter4576
    peter4576
    Participant
    July 29, 2015 at 19:51

    Excelent! Thanks a lot! Now I am 99% from goal and you will get rid of me 🙂

    Avatar: Robert Hall
    Robert Hall
    Support staff
    July 29, 2015 at 19:52

    Hello,

    You’re welcome!

    Regards,
    Robert Hall.

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

The issue related to '‘Display itemnumber/ sku underneath producttitle in product-listing’' has been successfully resolved, and the topic is now closed for further responses

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.