Hi,
I would like show SKU for each product on Products Page, between product thumbnail and product name.
How can I do so?
This topic has 12 replies, 5 voices, and was last updated 10 years, 2 months ago ago by Eva Kemp
Hi,
I would like show SKU for each product on Products Page, between product thumbnail and product name.
How can I do so?
Hello,
If you want add SKU to shop page, you only need to add this code to the bottom of your child theme’s functions.php file.
/* Adding SKU to shop page */
add_action( 'woocommerce_after_shop_loop_item', 'prima_custom_shop_item', 5);
function prima_custom_shop_item() {
global $post, $product;
/* product sku */
echo '<p>SKU: '.$product->get_sku().'</p>';
}
Regards,
Robert Hall.
Hi.
Thank so much for your reply.
I am sorry that I cannot usnderstand what you mean exactly.
What do you mean by child theme’s functions.php?
I am not using Child Theme now.
I would appraciate where I have to go to find child theme’s functions.php.
Regards,
Hello,
Child theme folder is included in the theme package that you downloaded. Please check it. Upload the folder to wp-content/themes directory and then activate child theme in Appearance > Themes.
Best regards,
Jack Richardson.
Hi,
Thank you so much for your kind reply.
It is working and SKU is show on Products page now but I would like to change the place.
Currently, SKU is shown unser the Price.
I would like to show SKU under product thumbnail and above the product name.
What am I supposed to do?
Hello,
Did you remove the code?
I see SKU number only in products titles now.
Best regards,
Jack Richardson.
Hi,
I added the code again.
How to place SKU under the thumbnail picture and above the product name?
Regards,
Hello,
In order to achieve this you need edit the file wp-content/themes/woopress/woocommerce/content-product.php and add the code <?php echo '<div class="sku">' . $product->sku . '</div>'; ?> in line 94 before this code <?php if (etheme_get_option('product_page_productname')): ?>
Best regards,
Jack Richardson.
Hi,
SKU is showing as I wanted.
Thank you so much for your help.
Can I ask you one more question?
How do I manage font size of SKU?
Currently font of SKU is a liitle smaller than thr product name.
I would like to make them in same size.
Hello intelisystems,
please add following css code to custom.css:
.single-product .sku_wrapper {
font-size:16px
}
You may use other value for font size if needed.
Regards,
Stan Russell.
Hi. Thank you for your answer.
I tried but it is not working yet.
I was able to show SKU under the thumbnail picture and above the product name by the instruction to
edit the file wp-content/themes/woopress/woocommerce/content-product.php and add the code
<?php echo ‘<div class=”sku”>’ . $product->sku . ‘</div>’; ?> in line 94 before this code <?php if (etheme_get_option(‘product_page_productname’)): ?>
I want to change size of this font now.
Hello,
Please add this code in child style.css:
.sku {
font-size: 15px;
}
Regards,
Eva Kemp.
You must be logged in to reply to this topic.Log in/Sign up