moltin / moltin-shippo-tracking

📦 Update orders via a webhook with a delivery status by Shippo
MIT License
1 stars 0 forks source link

Question: order_id #1

Open agrohs opened 5 years ago

agrohs commented 5 years ago

@notrab, is this example working? How is the extra.order_id getting populated on the Shippo Shipment object?

It seemed according to the Shippo docs (https://goshippo.com/docs/reference#shipments-extras) that there are a fixed set of fields that can be sent into the extra property.

Also, if this does work to send in a custom order_id field into the Shipment.create call, how does that flow work from moltin as you'd seemingly need to call Shipment.create to get back rates before a cart becomes an order - whereby you wouldn't yet have an order_id available 🤔.

Not saying this doesn't work, just need some more details to see how to get it all set up!

agrohs commented 5 years ago

Just following up that I did get a fake extra.order_idpassed in successfully via:

 this.shippo.shipment
      .create({
        address_from: shipFromAddress,
        address_to: shipToAddress,
        parcels: shipParcels,
        extra: { order_id },
        async: false
})

so disregard the first portion of the question, BUT I'm still wondering how we would have an order_id to be able to pass in to the shipment.create call if that needs to be made to get back shipping rates as wouldn't that happen while you still have a cart, not yet an order??