Snippet to Add Invoice number in the FedEx label. Supports only for WooCommerce PDF Invoices By Bas Elbers. WooCommerce FedEx Shipping plugin: https://www.pluginhive.com/product/woocommerce-fedex-shipping-plugin-with-print-label/
/** | |
* Snippet to add invoice number in fedex label. Support for WooCommerce PDF Invoices By Bas Elbers. | |
* Created at : 18 April 2018 | |
* Updated at : 18 April 2018 | |
* PluginHive Plugins : https://www.pluginhive.com/product-category/woocommerce-plugin/ | |
* Gist Link : https://gist.github.com/xadapter/79d628b412a2c7f9b3cbbcee419239a4 | |
*/ | |
add_filter( 'wf_fedex_request', 'xa_fedex_add_invoice_number', 10, 2 ); | |
if( ! function_exists('xa_fedex_add_invoice_number') ) { | |
function xa_fedex_add_invoice_number( $request, $order ) { | |
$invoice_number = $order->get_meta('_bewpi_invoice_number'); // _bewpi_invoice_number to support WooCommerce PDF Invoices By Bas Elbers | |
if( ! empty($invoice_number) ) { | |
foreach( $request['RequestedShipment']['RequestedPackageLineItems'] as $key => $request_package_line_item ) { | |
$request['RequestedShipment']['RequestedPackageLineItems'][$key]['CustomerReferences'][] = array( | |
'CustomerReferenceType' => 'INVOICE_NUMBER', | |
'Value' => $invoice_number, | |
); | |
} | |
} | |
return $request; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment