Saturday , February 22 2025

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 iryna

I'm Iryna, a web developer from Ukraine with a decade of experience solving complex technical challenges in the world of freelance. Throughout my career, I've worked on everything from troubleshooting server-side issues and optimizing website performance to enhancing user interfaces. On this blog, I share detailed solutions to the technical problems I’ve encountered and methods that have worked best for me. In addition to my technical expertise, I’m also passionate about digital drawing. I hope the tutorials and insights I provide here will help both fellow developers and creatives alike in their own projects.

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 *