The new delivery profiles API sounds great, however upon testing it seems to have major bugs, hoping someone can can help clarify what i'm seeing.
From what I understand, we can assign products to a delivery profile and each profile will have associated shipping rates, if a customer purchases from multiple profiles at the same time, the rate will then be combined into a single rate.
Consider the following scenario:
> product A
- shipping rate:
> carrier service plugin A
> product B
- shipping rate:
> carrier service plugin B
** For the purposes of this example the carrier service plugin A and B i used the same plugin, this plugin was configured to always return a flat rate of $10 **
Now assuming a customer places both product A and product B in the cart, from the described functionality I assume carrier service plugin A would receive a request with just product A in it, and carrier service plugin B would receive a request with just product B in it. Both plugins would return $10 and the final shipping rate will be $20.
Running my test, and using the same plugin, i only received a *single* carrier service request from Shopify, this request had both products in it. The plugin returned a single $10 rate and Shopify doubled it to $20 which was displayed at checkout.
- why is only a single request made?
- why does the request contain all the items in the cart rather than just the delivery profile ones? are we expected to keep a copy of the delivery profile on the app side and filter out the irrelevant products? doesn't it make more sense for Shopify to filter out the irrelevant products first? If not, every single shipping app out there will need to be updated to be profile aware whereas if Shopify just filtered out the irrelevant products most apps should be compatible off the bat.
- for the scenario above, as both profiles had a intended $10 shipping rate, the final $20 was technically correct, however if each profile were to have different shipping rates assigned, making a single carrier service call and doubling the rate will lead to incorrect results.
Any clarification would be appreciated.
Thanks for taking the time to layout your setup very clearly.
> why is only a single request made?
I just tested this on my end and am not seeing the same result. I received 1 request per profile+location in my cart as expected.
Can you double check that your products are associated to different profiles? Feel free to DM me your test shop / app details.
> why does the request contain all the items in the cart rather than just the delivery profile ones
This is a bug, and calls to your carrier service app should only contain the items relevant to that profile+location, as you'd expect.
We will look into this, good catch!
> making a single carrier service call and doubling the rate will lead to incorrect results.
We definitely don't want to be doing that. As far as I can tell, we aren't actually doing this behavior. The correct result in your scenario should have resulted from making multiple calls to your carrier service app, getting $10 back each time, then consolidating those rates. Are you able to quickly modify your responses (say, based on origin) and return different rates to confirm what is happening? (doubling versus consolidation)
Thanks for looking into this for me, the products listed under each profile seem to reset by themselves and I've found another bug, when adding products, after you click save, the products disappear immediately, however back on the summary screen, it shows the correct number of products.
I tried to run the test again but i'm shown an error during checkout now after entering my shipping address and clicking 'Continue to Shipping', i get the following message and redirected back to the Contact Information page
I've DM'ed you my store name for you to look at.
why does the request contain all the items in the cart rather than just the delivery profile ones
Alex_B - I wish all items were in the request! I am wanting to receive a list of all the products in the cart and not just the ones that match this profile, is there a way for my carrier_service callback_url endpoint to receive that information?
My scenario is that our app will calculate custom shipping price if the product was created from our app, but if it wasn't then we will use the store's main shipping rules/profile. Everything works great except when a customer wants to checkout with one item from our app + one regular store item. I want the shipping to be standard shipping + our app's custom shipping. Does that make sense?