| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPO\WC\PostNL\Compatibility; |
| 4 |
|
| 5 |
use WC_Order; |
| 6 |
use WPO\WC\PostNL\Compatibility\Order as WCX_Order; |
| 7 |
|
| 8 |
/** |
| 9 |
* Class for compatibility with the ChannelEngine plugin. |
| 10 |
* |
| 11 |
* @see https://wordpress.org/plugins/channelengine-woocommerce |
| 12 |
* @see https://github.com/channelengine/woocommerce |
| 13 |
* @package WPO\WC\PostNL\Compatibility |
| 14 |
*/ |
| 15 |
class WCPN_ChannelEngine_Compatibility |
| 16 |
{ |
| 17 |
/** |
| 18 |
* Add the created Track & Trace code and set shipping method to postnl in ChannelEngine's meta data |
| 19 |
* |
| 20 |
* @param WC_Order $order |
| 21 |
* @param $data |
| 22 |
*/ |
| 23 |
public static function updateMetaOnExport(WC_Order $order, $data) |
| 24 |
{ |
| 25 |
if (! class_exists('Channel_Engine') || WCX_Order::has_meta($order, "_shipping_ce_track_and_trace")) { |
| 26 |
return; |
| 27 |
} |
| 28 |
|
| 29 |
WCX_Order::update_meta_data($order, "_shipping_ce_track_and_trace", $data); |
| 30 |
|
| 31 |
// Todo: Check if this has to be changed |
| 32 |
WCX_Order::update_meta_data($order, "_shipping_ce_shipping_method", "PostNL"); |
| 33 |
} |
| 34 |
} |
| 35 |
|