Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Shipping rates callback problem - incomplete payload for multiple shipping profiles

Shipping rates callback problem - incomplete payload for multiple shipping profiles

pedrolizana
Visitor
1 0 1

Hi!

The problem is the following:
  • We have a Shipping Rates private App.
  • This App uses the following Shopify callback
  • The payload sent to this callback has the following structure:

{ "rate": { "origin": { "country": "CA", "postal_code": "K2P1L4", "province": "ON", "city": "Ottawa", "name": null, "address1": "150 Elgin St.", "address2": "", "address3": null, "phone": "16135551212", "fax": null, "email": null, "address_type": null, "company_name": "Jamie D's Emporium" }, "destination": { "country": "CA", "postal_code": "K1M1M4", "province": "ON", "city": "Ottawa", "name": "Bob Norman", "address1": "24 Sussex Dr.", "address2": "", "address3": null, "phone": null, "fax": null, "email": null, "address_type": null, "company_name": null }, "items": [{ "name": "Short Sleeve T-Shirt", "sku": "", "quantity": 1, "grams": 1000, "price": 1999, "vendor": "Jamie D's Emporium", "requires_shipping": true, "taxable": true, "fulfillment_service": "manual", "properties": null, "product_id": 48447225880, "variant_id": 258644705304 }], "currency": "USD", "locale": "en" } }

 

  • The problem with this callback arises when using multiple Shipping Profiles.
  • When creating a checkout with items from two (or more) Shipping Profiles, the callback is triggered twice (or more times), each request with the Shipping Profile line items, but each independent request does not send information regarding the total order value or the checkout_id.
  • Hence it is not possible to calculate free shipping (based on order value) on our App. 
Here is an example:
  • If I buy Product 1 (value 20 USD) in Shipping Profile 1 and Product 2 (value 30 USD) in Shipping Profile 2, two requests are sent to our App:
    • Request 1:origin address, destination address, items: Product 1. Request items value 20 USD.
    • Request 2: origin address, destination address, items: Product 2. Request items value 30 USD.
  • Lets say, the store has a free shipping order value on purchases over 40 USD. However, with the current structure of the payload it is not possible to determine if a checkout qualifies for free shipping, since in one request the items value is for 20 USD and for the second request the items value is 30 USD. 
  • To be able to calculate free shipping, we would need to receive information regarding the total checkout value (i.e. 50 USD). And that information is not sent in the callback.
What options are available for this scenario?
 
Thanks!
Replies 0 (0)