Support » Plugin: Advanced Shipment Tracking for WooCommerce » Compatibility with Shippo

  • Resolved happyday25

    (@happyday25)


    Is there any code or a workaround available that would allow me to automatically load tracking information synced from Shippo in to the Advanced Shipment Tracking plugin fields? Right now, Shippo puts the info in the Woocommerce order notes. I contacted Shippo to see if they have any documentation on how to do this but they would rather users go through their system and so don’t offer alternative solutions.

Viewing 15 replies - 1 through 15 (of 19 total)
  • Plugin Author zorem

    (@zorem)

    Hi @happyday25, yes you are correct, we contacted Shippo in the past to add compatibility but they were not interested to cooperate.
    In general, you will need to know which hook they use for adding the tracking info to the order notes and this is the example of the code you need to use to add the tracking info to the shipment tracking order meta fields:
    https://gist.github.com/zorem/7acdd3906e68721c0f20d3905e79f780

    Thank you @zorem, I found these webhooks in Shippo’s documentation. Would any of these work for the code you provided? I don’t know much about programming.

    https://goshippo.com/docs/webhooks/
    https://gist.github.com/simonkreuz/7d3f232bb66292fd8c248c5ec477fa83

    Plugin Author zorem

    (@zorem)

    Hi, from this docs, it seem that you can create a webhook on their system and to update the Rest API endpoint that we provide with the AST plugin to add tracking info to your orders, you can read more about how to create the API call to update the tracking numbers in orders on our documentation – https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/rest-api-support/

    Thank you @zorem. Would you be able to provide me with an example or template of how the shippo webhooks and REST API Support for the advanced shipment tracking should be combined? My knowledge of webhooks, post requests, endpoints, etc. is pretty limited and my level of experience consists of making minor edits to code in my wordpress functions.php.

    Plugin Author zorem

    (@zorem)

    Hi, on our API docs, we show an example of how to create an API call to the REST API endpoint and add the tracking info to your orders
    https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/rest-api-support/

    You will need to use this example on Shippo Webhook and change the variables for the tracking values but since we are not familiar with their webhooks, you will need to contact Shippo support or check their Docs for guidelines on how to create and construct the Webhook on their system.

    Thanks

    @zorem, ok thank you for the information. I will contact Shippo again and see if they can offer any help with their webhooks.

    Hi @zorem, where do I put the Endpoint code in my WordPress site? Does it go in the functions.php file? Thanks!

    Plugin Author zorem

    (@zorem)

    The AST plugins adds Shipment Tracking Endpoint in the plugin code, the endpoint can be used to make API calls to the WooCommerce REST API by external applications to update the tracking info in orders.

    See the WC documentation on how to generate API keys and then with the Key you get authorization to update the WC REST API.

    Let me know if you need further assistant

    Thanks

    Shippo automatically creates a REST API when linking to WordPress. Will this be the same API that is used to communicate with the AST plugin or do I need to create a separate one?

    Where do I go to modify the Shipment Tracking Properties (meta fields) in the AST plugin to match those in Shippo?

    Plugin Author zorem

    (@zorem)

    Hi,

    Shippo is updating the WC REST API orders endpoint and as I understand, places the tracking into in the order notes.
    See the WooCommerce REST API Docs – https://docs.woocommerce.com/document/woocommerce-rest-api/

    our plugin adds an endpoint in the WC REST API which allows updating the tracking info into orders. you can find an example of how to use this endpoint to update tracking from external service – Shippo will have to use our endpoint when they update your store with the API:
    https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/rest-api-support/

    Thanks

    Thank you @zorem. If I understand correctly then, everything on the AST plugin side should be ready to go. The REST API is in place and I have setup webhooks on the Shippo side that point to https://<MYDOMAIN.COM>/wp-json/wc/v1/orders/shipment-trackings. When attempting to POST a test payload however, I am receiving a 404 Not Found error on Shippo. I have contacted Shippo about this and they said everything looks configured properly on their end. What am I still missing? Thank you.

    • This reply was modified 1 month, 1 week ago by happyday25.

    Hi @zorem, any thoughts on my last note? I have been searching all over for possible solutions without much luck. Thank you.

    Plugin Author zorem

    (@zorem)

    Hi, can you send me the API call you are doing?

    • This reply was modified 1 month, 1 week ago by zorem.

    Hi @zorem, if by the API call you mean https://<MYDOMAIN.COM>/wp-json/wc/v1/orders/shipment-trackings, this is the exact call I am using and what is referenced on the AST plugin documentation: https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/rest-api-support/.

    When testing in my browser and after replacing <MYDOMAIN.COM> with my actual domain, I receive this error:

    {“code”:”rest_no_route”,”message”:”No route was found matching the URL and request method”,”data”:{“status”:404}}

    If I take off “shipment-trackings” at the end of the call and use https://<MYDOMAIN.COM>/wp-json/wc/v1/orders, I receive this error:

    {“code”:”woocommerce_rest_cannot_view”,”message”:”Sorry, you cannot list resources.”,”data”:{“status”:401}}

    If I use the call https://<MYDOMAIN.COM>/wp-json/wc/v1/orders/<order-id>/shipment-trackings and replace <MYDOMAIN.COM> with my actual domain and <order-id> with an actual order number, I receive this error:

    {“code”:”woocommerce_rest_cannot_view”,”message”:”Sorry, you cannot list resources.”,”data”:{“status”:401}}

    When setting up Shippo, a REST API is set up automatically in WooCommerce. I have tested it via the Shippo documentation and it is responding properly:
    https://support.goshippo.com/hc/en-us/articles/360024612052

    I also created a new REST API via the documentation provided on WooCommerce:
    https://docs.woocommerce.com/document/woocommerce-rest-api/

    I tested the new API using the WooCommerce testing documentation:
    https://github.com/woocommerce/woocommerce/wiki/Getting-started-with-the-REST-API
    Testing came back with this error:

    {“code”:”woocommerce_rest_cannot_view”,”message”:”Sorry, you cannot list resources.”,”data”:{“status”:401}}

    After disabling all security plugins, JavaScript optimization plugins, and removing all code from the .htaccess file, I still receive the errors listed above.

    The only other thing I can think of would be that there is still some additional code that I need to place somewhere on my site such as the “POST /wp-json/wc/v1/orders/<order_id>/shipment-trackings” code listing in the AST documentation. If I do need to add this to the site somewhere, where do I add it?

    Do I also need to change the meta fields of the AST plugin to match Shippo’s? If so, where in the AST plugin code do I make these changes?

    When creating the REST APIs, I am given a Consumer Key and a Secret Key. Do these need to be added in the AST plugin code somwhere? If so, where?

    Do you have other ideas where the problem might be?

    Thank you.

    Plugin Author zorem

    (@zorem)

    Hi, the shipment tracking Endpoint is created by the AST plugin at this URL. On the documentation I sent you for the API, you can find the API call properties to use for the tracking parameters when you set the call from Shippo.

    from the error message you are getting(401) – its authorization error, your entire WooCommerce REST API is blocked for external calls, not just the AST endpoint, Maybe you should check with your hosting company if they are blocking external HTTP requests.

    Thanks.

Viewing 15 replies - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.