I created a new attribute for my woocommerce products using slug 'short-title'. The idea is that I want to redefine the name on the pages of the store with a short name. I installed a loop with the following:
if (get_post_meta($product->id, 'short-code', true)) { $product_name = (get_post_meta($product->id, 'short-code', true)); } else { $product_name = get_the_title(); } echo '<div class="product-below"><h4 class="product-name">'.$product_name.'</h4>';
But this does not override the title when I enter a value in the short title field for the product. I think I need another function from get_post_meta p>
source share