Friday , December 20 2024

How to display product SKU in Woocommerce product card

As it often happens, we do not need product SKU where it is placed in the template. To display in the right place, use this code:

<?php echo '' . $product->sku . ''; ?>

When I published this code on a test project (in /woocommerce/single-product/short-description.php) as a result, the product SKU was not displayed, because it was necessary to add global $product; above.

Full code:

<?php
global $product; 
echo '' . $product->sku . ''; 
?>

About admin

Hi there! My name is Iryna, I am a web developer from Ukraine. While working on freelance projects I often face different technical issues and in this blog I publish articles on how to solve them. I am also interested in digital drawing and in this blog you will find brief tutorials that helped me and hopefully can help you as well.

Check Also

How to remove 404 //fonts.gstatic.com and //fonts.googleapis.com from WordPress head section

I tried solutions with functions that should remove from head and , but a very …

Leave a Reply

Your email address will not be published. Required fields are marked *