Home › Forums › WoodMart support forum › Show Sku
Show Sku
- This topic has 10 replies, 2 voices, and was last updated 2 years, 7 months ago by Artem Temos.
-
AuthorPosts
-
January 3, 2019 at 8:03 pm #99716
InterfictoParticipantHi, I request your help to know what files should be modified to show the sku in the listings, the search by ajax and in the home widget for products.
January 4, 2019 at 7:01 am #99764
Artem TemosKeymasterHi,
To customize the view of products grid you need to edit the file
woodmart/woocommerce/content-product-tiled.php
. As for the search results, find it in the filejs/functions.js
. You will need to disable JS minification in Theme Settings -> Performance.Kind Regards
January 6, 2019 at 6:50 pm #100223
InterfictoParticipantHello, I can’t get it. I will go explain betther with a image.
1) I need show SKU below title in woocommerce prodcut ategory.Please check image1.png
2) I need show SKU below title in visual composer products tab. Please view image2.png
3) I need show SKU below title in Ajax Search. PLease view image3.pngCan you help me please?
Attachments:
You must be logged in to view attached files.January 7, 2019 at 3:33 am #100254
InterfictoParticipantHello, I go it, I leave the answer here for others members and future reference:
In the file:
inc/modules/search.php
Add below line 253
‘sku’ => $product->get_sku(),The complete fragment is:
$suggestions[] = array( 'value' => get_the_title(), 'permalink' => get_the_permalink(), 'price' => $product->get_price_html(), 'thumbnail' => $product->get_image(), 'sku' => $product->get_sku(), );
In the file js/functions.php
Add below the line 2127:
returnValue += ‘<span class=”e-product-sku”>Ref: ‘+ suggestion.sku +'</span>’;The complete fragment:
returnValue += '<h4 class="suggestion-title result-title">' + suggestion.value .replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>') // .replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/<(\/?strong)>/g, '<$1>') + '</h4>'; returnValue += '<span class="e-product-sku">Ref: '+ suggestion.sku +'</span>';
In the file:
woocommerce/content-product-tiled.phpbelow the line 40:
add
<?= ‘<span class=”e-product-sku”>Ref: ‘ . $product->get_sku() . ‘</span>’;?>The complet fragment:
<?php /** * woocommerce_shop_loop_item_title hook * * @hooked woocommerce_template_loop_product_title - 10 */ do_action( 'woocommerce_shop_loop_item_title' ); ?> <?= '<span class="e-product-sku">Ref: ' . $product->get_sku() . '</span>';?> <?php woodmart_product_categories(); woodmart_product_brands_links(); ?>
I attached the files. Please remever disable miify option in theme function
Attachments:
You must be logged in to view attached files.January 7, 2019 at 8:54 am #100290
Elise NoromitMemberHello,
Thanks for sharing.
Best Regards
July 6, 2019 at 11:50 am #131579
Bety CastilloParticipantI want to do the same thing to show the sku in the archive page products.
Question… will not this be lost if we update the theme?July 6, 2019 at 5:54 pm #131595
Artem TemosKeymasterIf you will do the modification in the parent theme folder then you will have to reapply your customization after the update since they will be overridden.
July 14, 2019 at 1:57 am #132590
Bety CastilloParticipantI did everything that Interficto mentioned, but it did not work for me, I also made sure to disable the JS minification
Do you know something else that is missing to show the sku in the listings?Attachments:
You must be logged in to view attached files.July 14, 2019 at 6:39 am #132595
Artem TemosKeymasterBe sure that you are editing a correct file that depends on your hover effect selected in Theme Settings -> Shop. Files are located here
woodmart/woocommerce/content-product-*.php
.April 11, 2022 at 7:02 am #367466
razwan73ParticipantHi,
What will be the custom code if I want to add SKU before the Title in SHOP page or Archive Page?
Thanks
Attachments:
You must be logged in to view attached files.April 11, 2022 at 7:09 am #367473
Artem TemosKeymasterHello @razwan73
Please, create a separate topic and send us your website link so we could help you.
Kind Regards
-
AuthorPosts
Tagged: sku
The topic ‘Show Sku’ is closed to new replies.
- You must be logged in to create new topics. Login / Register