WooCommerce PDF Invoices & Packing Slips
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// add Credit Note details add_filter('woe_get_order_fields', 'woe_add_order_fields'); function woe_add_order_fields($fields) { $fields['credit_note_number'] = array( 'label' => 'Credit Note Number', 'colname' => 'Credit Note Number', 'checked' => 1 ); $fields['credit_note_date'] = array( 'label' => 'Credit Note Date', 'colname' => 'Credit Note Date', 'checked' => 1 ); $fields['credit_note_date_formatted'] = array( 'label' => 'Formatted Credit Note Date', 'colname' => 'Formatted Credit Note Date', 'checked' => 1 ); return $fields; } add_filter('woe_get_order_value_credit_note_number', 'woe_get_credit_note_field', 10, 3); add_filter('woe_get_order_value_credit_note_date', 'woe_get_credit_note_field', 10, 3); add_filter('woe_get_order_value_credit_note_date_formatted', 'woe_get_credit_note_field', 10, 3); function woe_get_credit_note_field($value,$order, $field) { $refunds = $order->get_refunds(); if ( !empty( $refunds ) ) // take 1st! $value = get_post_meta( $refunds[0]->id, '_wcpdf_'.$field, true); return $value; } |