In the functions.php I use:
add_shortcode( 'output_post_sku', 'get_sku' );
And retrieve it with shortcode: [output_post_sku]
It doesn't work. Anyone familiar with this?
Thank you!
In the functions.php I use:
add_shortcode( 'output_post_sku', 'get_sku' );
And retrieve it with shortcode: [output_post_sku]
It doesn't work. Anyone familiar with this?
Thank you!
Share Improve this question asked Feb 25, 2020 at 11:57 BrentBrent 1 1 |1 Answer
Reset to default 0SKU display on product detail page. Add this code in functions.php
add_action( 'woocommerce_single_product_summary', 'show_sku', 5 );
function show_sku(){
global $product;
echo 'SKU: ' . $product->get_sku();
}
get_sku
? Is the SKU coming from EDD or somewhere else? When you say it doesn't work, can you be more specific? PHP fatal error? White screen of death? Empty output? Incorrect output? – Tom J Nowell ♦ Commented Feb 25, 2020 at 14:24