Display Woocommerce Advanced custom field
-
Hello,
i try to display an advanced custom field which i have created in my products to the pdf invoice, below the product, using the below code:
add_action( 'wpo_wcpdf_after_item_meta', 'wpo_wcpdf_product_custom_field', 10, 3 ); function wpo_wcpdf_product_custom_field ( $template_type, $item, $order ) { // check if product exists first if (empty($item['product'])) return; // replace 'Location' with your custom field name! $field_name = 'Supermarket'; $explain_idea_1 = method_exists($item['product'], 'get_meta') ? $item['product']->get_meta($field_name,true,'edit') : get_post_meta( $item['product']->id, $field_name, true ); if (!empty($explain_idea_1)) { echo '<div class="product-Supermarket">Supermarket: '.$explain_idea_1.'</div>'; } }
This doesn’t work, nothing change. Also i tried to insert _explain_idea_1 instead for explain_idea_1, but this doesn’t work too.
Please can you advise
Thank youThe page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Display Woocommerce Advanced custom field’ is closed to new replies.