Created
January 22, 2020 14:43
-
-
Save hedqvist/b6372ae86e4e25a0b5a86bdb83197ad2 to your computer and use it in GitHub Desktop.
Support for WooCommerce Shipment Tracking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @snippet WooCommerce - Unifaun plugin by Redlight Media - Add Support for WooCommerce Shipment Tracking | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.9.0 | |
| */ | |
| add_action( 'ac_wc_unifaun_shipment_print_successful_print', 'redlight_postnord_add_tracking', 10, 3 ); | |
| function redlight_postnord_add_tracking($body, $response, $order){ | |
| $provider = 'PostNord Sverige AB'; | |
| if ( isset( $body->pdfs ) ) { | |
| foreach ( $body->parcels as $parcel ) { | |
| if ( function_exists( 'wc_st_add_tracking_number' ) ) { | |
| wc_st_add_tracking_number( $order->get_id(), $parcel->parcelNo, $provider); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment