Send tracking info on order complete
-
Hi, is it possible to send tracking info on order completion?
For example, Klarna added this filter recently:
/** * Add custom tracking data to the Klarna capture request. * You can find more info about what fields you have to work with here: * https://developers.klarna.com/api/#order-management-api__create-capture__shipping_info * * @param array $args The request arguments. * @param int $order_id The WooCommerce order id. * @return array */ add_filter( 'kom_order_capture_args', 'kom_custom_tracking_info', 10, 2 ); function kom_custom_tracking_info( $args, $order_id ) { $provider = get_post_meta($order_id,'_tracking_provider', true); $tracking_id = get_post_meta($order_id,'_tracking_number', true); if(!empty($provider) && !empty($tracking_id)){ $shipping_info = array( 'shipping_company' => $provider, // The name of the shipping company used. For example DHL etc 'tracking_number' => $tracking_id, // The tracking number for the shipment. ); $args['shipping_info'] = $shipping_info; } return $args; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Send tracking info on order complete’ is closed to new replies.