This topic has 9 replies, 4 voices, and was last updated 9 years, 4 months ago ago by Robert Hall
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
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
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.
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…
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.
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
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.
Excelent! Thanks a lot! Now I am 99% from goal and you will get rid of me 🙂
Hello,
You’re welcome!
Regards,
Robert Hall.
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