wordpress - Woocommerce getting custom field values in cart and checkout -


i trying custom field value of woocommerce product display on different pages of shop system. succeeded single product page, same code doesn't work cart.

for single product used code within functions.php, works fine:

global $post; echo '<p>' . get_post_meta($post->id, 'my-custom-field', true) . '</p>'; 

i tried same code cart, time values don't show on page. referred thread (woocommerce getting custom attributes), changing $post $product, still no output...

any suggestions?

<?php echo get_post_meta( get_the_id(), 'slug/id', true ); ?> 

you can try this, works me well.


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -