• Resolved sylvain68

    (@sylvain68)


    Hello Zorem,

    Thank you very much for your great work (I just reviewed your excellent plugin).

    We use the official plugin of Mondial Relay, a famous French carrier (mondialrelay-wp.com). This plugin allows you to create shipments (generate labels etc.) from each order.

    We would like to see tracking information (shipment date, carrier type and tracking number) automatically added to Advanced Shipment Tracking each time a Mondial Relay shipment is created.

    I know you have a lot of carriers to manage and you don’t necessarily automate this for each of them…

    I’m wondering if you provide methods to add tracking automatically.

    In this case I could check with the developer of the Mondial Relay plugin if he provides a “hook” that would allow me to trigger the automatic creation of a tracking and place this code in functions.php.

    I saw that you were offering REST API support. You developed this to have access to your API from a remote website or also to be able to use it between your plugin and another on the same instance of WordPress?

    Thank you in advance for your answer.

    Kind regards,
    Sylvain

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Zorem

    (@zorem)

    Hello,

    You can use below code to add tracking info into your orders.

    $wcast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
    $args = array(
    ‘tracking_provider’ => ‘provider’,
    ‘tracking_number’ => ‘number’,
    ‘date_shipped’ => ‘status’,
    ‘status_shipped’ => ‘1/0’,
    );
    $wcast->add_tracking_item( $order_id, $args );

    Let me know if you have any further questions.

    Thanks,

    Thread Starter sylvain68

    (@sylvain68)

    Hello,

    Thank you very much for your help. It works very well.

    Some news for those who would like to automate the creation of shipment tracking when sending with Mondial Relay (see mondialrelay-wp.com, official plugin):

    – The developer has just released a version 1.5.1 with the necessary hook.

    – Here is the code we use (to be adapted according to your needs):

    add_action( 'MRWP_after_expedition_creation', 'add_shipment_tracking_for_mondial_relay' );
    function add_shipment_tracking_for_mondial_relay($order_id) {
        $order = wc_get_order($order_id);    
        $wcast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
        $args = array(
            'tracking_provider' => 'mondial-relay',
            'tracking_number'=> $order->get_meta('ExpeditionNum'),
        );
        $wcast->add_tracking_item( $order_id, $args );
    }

    Kind Regards,

    Sylvain

    Plugin Author Zorem

    (@zorem)

    Thanks, we will check your code and if possible will add it to the plugin in the next releases or add it to our documentation code snippets

    Thread Starter sylvain68

    (@sylvain68)

    Hi,

    Well, very good idea!

    So if you want to integrate this code into your plugin, maybe you could also plan to add Mondial Relay to your list of carriers? Thus the carrier’s ID could not be modified by users (“mondial-relay” in my case) …

    This is the url link for tracking:
    https://www.mondialrelay.fr/suivi-de-colis?codeMarque=CC&numeroExpedition=%number%

    And here is a link to the carrier’s logo: https://we.tl/t-GMUAF6ZRGz (7 days to download).

    (Carrier’s name: Mondial Relay / Country: France)

    Thanks in advance and have a nice afternoon.

    Kind Regards,

    Sylvain

    Plugin Author Zorem

    (@zorem)

    Ok, sure, thanks!

    Plugin Author Zorem

    (@zorem)

    Hi @sylvain68 ,We just released latest version of plugin and added Mondial Relay as a default shipping provider.

    Thanks,

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Automatic addition of shipment tracking’ is closed to new replies.