Home Forums WoodMart support forum Show Sku Reply To: Show Sku

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