1

I got the sku to to show in the cart for each item - Does anyone have the correct php code to get the sku under each product name on all pages?

2 Answers 2

0

You can use the woocommerce_single_product_summary hook,

so code will be like

add_action( 'woocommerce_single_product_summary', 'product_sku' ); function product_sku(){ global $product; echo '<div class="sku-product">' . $product->sku . '</div>'; }
0
0

This is the answer:

add_action( 'woocommerce_after_shop_loop_item_title', 'custom_after_title' ); function custom_after_title() {

global $product;

if ( $product->get_sku() ) { echo $product->get_sku(); }

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.