Why this snippet not work ?
-
Hi,
I have created a snippet code for print a custom field of woocommerce product.
My custom field is a subtitle, and it has this id: _subtitol_productsThis is my code:
add_action( ‘woocommerce_single_product_summary’, ‘display_subtitol_products’, 9 );
function display_subtitol_products() {
global $product;
//echo $product->id;
// echo get_post_meta(361, ‘_subtitol_products’, true);
echo get_post_meta( $product->id, ‘_subtitol_products’, true);
}The first comment line it works, the second comment line it works too.
The get_post_meta not works.Can you help me ?
Thanks and regards
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Why this snippet not work ?’ is closed to new replies.