Shopify Ajax API issue

Shopify Partner
136 1 8

Hello,

there's an inconsistency between the Shopify AJAX API /cart/shipping_rates.json method and the Shopify checkout shipping rates.

Long story short: when there are several shipping methods and one of them throws an error, the AJAX API gives an error while the Shopify checkout simply ignores that shipping method and show the others.

This breaks any attempt to display the available shipping rates as we do in our app Shipping Rates Calculator+.

Here follows a detailed bug description and test case.

We have created a development store at https://shipping-rates-api-issue.myshopify.com/ with 2 shipping rates:

  • Weight based rates (flat rate from 0 to 999lb)
  • USPS carrier-calculated rates

When a product lighter than 100lb is added to the shopping cart, everything works as expected, both on the shopping cart page:

and the checkout pages:

However, when a product heavier than 100lb is added to the shopping cart, USPS gives an error.

That leads to an error in the Shopify API AJAX call. This is the request URL:

https://shipping-rates-api-issue.myshopify.com/cart/shipping_rates.json?shipping_address%5Bcountry%5...

and the response JSON:

{"error":["The item with weight of 45359.0g is heavier than the allowable package weights"]}

For that reason, the shipping rates cannot be displayed on the shopping cart page:

However, and this is the key point, the error is silently ignored in the checkout, falling back to the other shipping methods available:

Please contact us if you need any other information. Feel free to test it using our development store at https://shipping-rates-api-issue.myshopify.com/

We would be grateful if you could take a look at the issue because it's already been experienced by several of our customers.

Kind regards,
  Mike
  Code Black Belt

 

 

 

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
93 0 12

Hey Mike,

Mike here from Shopify. Just looking at your site and your settings I can see the 1000,00 brick has a weight of 100LBS in its setup under the PRODUCTS TAB. That said, USPS has a weight restriction of 70lbs to ship generally, so your 100lb product stands to reason to not be available in your shipping calculation. Also, take note that under SETTINGS>SHIPPING there is a default box size, that it too carries a weight of 0.188kg so that would get factored into the rate returned back from USPS. 

Now here is the thing, why does the checkout give you a rate? Look at your shipping under SETTINGS. For the Domestic US, you also have a weight based rate of 0-999.0lbs so your product does fall within that dimension for your shipping. Its also 10 Dollars. I think it is your extra 9 :)

https://screenshot.click/09-01-d575y-1rzpr.jpg

This should be the reason you get the rate, or that fallback you see.

I hope that helps.

Regards,

-Mike A.

 

0 Likes
Highlighted
Shopify Partner
136 1 8

Hello Mike A.,

this is Mike from Code Black Belt, thanks for taking the time to look at the issue.

However, please note that the configured rates were only an example, and the whole point of my explanation was to note the inconsistency of the shipping rates returned by the Shopify AJAX API and by the Shopify checkout.

The issue remains as long as one shipping rate throws an error, regardless of the cause of the error.

This makes impossible for us to display shipping rates consistent with the ones displayed on checkout.

Kind regards,
  Mike
  Code Black Belt
 

0 Likes
Highlighted
New Member
5 0 0

We are having the same issue. We are now using a shipping app that breaks down products (like those over 70lbs) into multiple boxes to help resolve the issue but it doesn't do a lot of good if people are dettered in the cart view and not even making it into the checkout view to see that there are shipping options.

Is there a fix for this?

0 Likes
Highlighted
Shopify Partner
136 1 8

Hello Peter,

this is Mike, the initial reporter of the issue.

Unfortunately, we have no news about it. I have just tested it and the problem persists.

One of our customers told us that a Shopify member told them that they were working on it but we haven't heard anything else after that.

Kind regards,
  Mike
  Code Black Belt


 

0 Likes
Highlighted
New Member
10 0 0

It looks like the Advanced Shipping app helped. It was continuing to give me the error because it was still reading the Shopify shipping options. Once I removed the Shopify shipping options it used the app shipping rates and it works now, as long as there is a shipping option in the app for the location. 

Just thought I'd give you an update. You may find this app helpful: http://www.advancedshippingmanager.com/

0 Likes