• Resolved rumblewand

    (@rumblewand)


    Hello, we are trying to get AST to automatically pull label data from the Elex EasyPost plugin as we love your tracking integration with Twilio and Woocommerce. We emailed Elex to ask for the needed hooks to pull this data and this is what they sent back. I am used to using normal hooks in snippets to pull data but I think they are using a class function and have all the data wrapped into it.

    Can you help me get these hooks to work with AST?

    get_post_meta($order_id, ‘wf_easypost_labels’);

    Sample output:

    array(

    0=>(‘url’=>label_url,’tracking_number’=> (string)’tracking code’,’integrator_txn_id’=> ‘integerator_id’,’shipment_id’=>’package_shipment_id’,’order_date’=>order_date,’carrier’=>EX:USPS,”link”=>tracking_link,);//First package

    1=>(‘url’=>label_url,’tracking_number’=> (string)’tracking code’,’integrator_txn_id’=> ‘integerator_id’,’shipment_id’=>’package_shipment_id’,’order_date’=>order_date,’carrier’=>EX:USPS,”link”=>tracking_link,);//Second package

    )

    Thank you! We love your plugin!

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter rumblewand

    (@rumblewand)

    We attempted several iterations to get this working with the published snippet for pulling tracking data from external plugins posted on the AST website with no luck. Would you recommend we try shipstation instead? I know that aftership works with shipstation but we like your tracking service better with twilio.

    Double data entry for every order won’t work though so any input appreciated.

    Plugin Author Zorem

    (@zorem)

    Hi, you need to ask the Elex plugin to provide you with the hook where they add the tracking info to the order and you need to use their hook in your code.

    Thanks

    Thread Starter rumblewand

    (@rumblewand)

    I did that originally and posted the code they provided above but I don’t get how to use class hooks (if that’s what it is called). Normal hooks I understand but that array makes zero sense to me ??

    Plugin Author Zorem

    (@zorem)

    Hi, I think its best that you will hire a developer to help you, the code we have in docs is what you need to do, you just need to place this code inside a hook from Elex plugin. You can check below code snippet for how to add tracking info into order using hook – https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/compatibility/#shipping-labels-plugins.

    Thread Starter rumblewand

    (@rumblewand)

    Yeah – we started with the snippet

    <?php
    add_action( ‘woocommerce_shipstation_shipnotify’, ‘add_tracking_information_into_order’, 10, 2 );
    function add_tracking_information_into_order($order, $tracking_details){
    $order_id = $order->get_id();
    $args = array(
    ‘tracking_provider’ => $tracking_details[‘carrier’],
    ‘tracking_number’ => wc_clean( $tracking_details[‘tracking_number’] ),
    ‘date_shipped’ => wc_clean( $tracking_details[‘ship_date’] ),
    ‘status_shipped’ => 1,
    );
    $ast = new WC_Advanced_Shipment_Tracking_Actions;
    $tracking_item = $ast->insert_tracking_item( $order_id, $args );
    }

    and asked Elex for the hooks. I get that the Elex array contains this info. I’m just not sure it works normally as it is contained in a class. A developer could do it yes but then I won’t be able to learn for the future. This is currently what I have:

    <?php
    add_action( ‘woocommerce_shipstation_shipnotify’, ‘add_tracking_information_into_order’, 10, 2 );
    function add_tracking_information_into_order($order, ‘wf_easypost_labels’){
    $order_id = $order->get_id();
    $args = array(
    ‘tracking_provider’ => ‘wf_easypost_labels’[’carrier’],
    ‘tracking_number’ => wc_clean( ‘wf_easypost_labels’[’tracking code’] ),
    ‘date_shipped’ => wc_clean( ‘wf_easypost_labels’[’order_date’] ),
    ‘status_shipped’ => 1,
    );
    $ast = new WC_Advanced_Shipment_Tracking_Actions;
    $tracking_item = $ast->insert_tracking_item( $order_id, $args );
    }

    I will report back findings.

    Thread Starter rumblewand

    (@rumblewand)

    So far I have gotten to this point. I think the hook I am using may need to be the corrected or perhaps I need to load the Elex Class??? Not sure. My limited PHP knowledge comes from trial and error. Anyway – this is my current snippet

    add_action( ‘woocommerce_checkout_update_order_meta’, ‘add_tracking_information_into_order’, 10, 2 );
    $myship_func = get_post_meta($order_id, ‘wf_easypost_labels’);
    function add_tracking_information_into_order($order, $myship_func){
    $order_id = $order->get_id();
    $args = array(
    ‘tracking_provider’ => $myship_func[‘carrier’],
    ‘tracking_number’ => wc_clean($myship_func[‘tracking code’]),
    ‘date_shipped’ => wc_clean($myship_func[‘order_date’]),
    ‘status_shipped’ => 1,
    );
    $ast = new WC_Advanced_Shipment_Tracking_Actions;
    $tracking_item = $ast->insert_tracking_item( $order_id, $args );
    }

    Plugin Author Zorem

    (@zorem)

    You should contact Elex and ask for their support, it’s a premium plugin, they should provide you with support.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Integration with Elex EasyPost’ is closed to new replies.