Home Forums WoodMart support forum Show Sku

Show Sku

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #99716

    Interficto
    Participant

    Hi, 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.

    #99764

    Artem Temos
    Keymaster

    Hi,

    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 file js/functions.js. You will need to disable JS minification in Theme Settings -> Performance.

    Kind Regards

    #100223

    Interficto
    Participant

    Hello, 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.png

    Can you help me please?

    Attachments:
    You must be logged in to view attached files.
    #100254

    Interficto
    Participant

    Hello, 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, '&quot;')
                                    .replace(/<(\/?strong)>/g, '<$1>') + '</h4>';
                                returnValue += '<span class="e-product-sku">Ref: '+ suggestion.sku +'</span>';

    In the file:
    woocommerce/content-product-tiled.php

    below 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.
    #100290

    Hello,

    Thanks for sharing.

    Best Regards

    #131579

    Bety Castillo
    Participant

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

    #131595

    Artem Temos
    Keymaster

    If 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.

    #132590

    Bety Castillo
    Participant

    I 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.
    #132595

    Artem Temos
    Keymaster

    Be 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.

    #367466

    razwan73
    Participant

    Hi,

    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.
    #367473

    Artem Temos
    Keymaster

    Hello @razwan73

    Please, create a separate topic and send us your website link so we could help you.

    Kind Regards

Tagged: 

Viewing 11 posts - 1 through 11 (of 11 total)

The topic ‘Show Sku’ is closed to new replies.