Adding Custom Field Data To Item
-
I’m currently trying to pull in data from woocommerce product custom field that I’ve created using WP Admin Site Enhancements pro plugin with the field name ‘availability’ as shown.
add_action( 'wpo_wcpdf_after_item_meta', 'wpo_wcpdf_item_availability', 10, 3 ); function wpo_wcpdf_item_availability( $document_type, $order, $item ) { if ( $document_type === 'invoice' ) { if ( $item->get_cf( 'availability' ) ) { $availability = $item->get_cf( 'availability', true ); ?> <tr class="availability"> <th>Availability:</th> <td><?php echo esc_html( $availability ); ?></td> </tr> <?php } else { // Handle missing custom field (e.g., display message) } } }
I tried the above snippet to add the custom field data after item meta but doesn’t seem like it is working.
I’ve referred to the docs of the custom content type feature of the plugin here: https://www.wpase.com/documentation/custom-field-types/
Is there anyone that could help? Thanks in advance.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Adding Custom Field Data To Item’ is closed to new replies.