CarrierService API: Shopify sending Null information for Canada

jasper91
Shopify Partner
9 0 4

I've setup a CarrierService app, and when I edit the rates for the zone in Canada, Shopify will send mock data to return the eligible services from my app. However, the request body is (most importantly, the postal code) is null, so no rates can be calculated for this zone. This appears to happen sometimes for United States, but not always.

 

Shopify Request Body:  {
19:54:05 │ remix │   "rate": {
19:54:05 │ remix │     "origin": {
19:54:05 │ remix │       "country": "CA",
19:54:05 │ remix │       "postal_code": null,
19:54:05 │ remix │       "province": null,
19:54:05 │ remix │       "city": null,
19:54:05 │ remix │       "name": "Shop location",
19:54:05 │ remix │       "address1": {
19:54:05 │ remix │         "first_name": null,
19:54:05 │ remix │         "address1": null,
19:54:05 │ remix │         "phone": null,
19:54:05 │ remix │         "city": null,
19:54:05 │ remix │         "zip": null,
19:54:05 │ remix │         "province": null,
19:54:05 │ remix │         "country": "Canada",
19:54:05 │ remix │         "last_name": null,
19:54:05 │ remix │         "address2": null,
19:54:05 │ remix │         "company": null,
19:54:05 │ remix │         "latitude": null,
19:54:05 │ remix │         "longitude": null,
19:54:05 │ remix │         "name": "",
19:54:05 │ remix │         "country_code": "CA",
19:54:05 │ remix │         "province_code": null
19:54:05 │ remix │       },
19:54:05 │ remix │       "address2": null,
19:54:05 │ remix │       "address3": null,
19:54:05 │ remix │       "latitude": null,
19:54:05 │ remix │       "longitude": null,
19:54:05 │ remix │       "phone": null,
19:54:05 │ remix │       "fax": null,
19:54:05 │ remix │       "email": null,
19:54:05 │ remix │       "address_type": null,
19:54:05 │ remix │       "company_name": "no-sig-checkout"
19:54:05 │ remix │     },
19:54:05 │ remix │     "destination": {
19:54:05 │ remix │       "country": "CA",
19:54:05 │ remix │       "postal_code": null,
19:54:05 │ remix │       "province": null,
19:54:05 │ remix │       "city": null,
19:54:05 │ remix │       "name": "Shop location",
19:54:05 │ remix │       "address1": {
19:54:05 │ remix │         "first_name": null,
19:54:05 │ remix │         "address1": null,
19:54:05 │ remix │         "phone": null,
19:54:05 │ remix │         "city": null,
19:54:05 │ remix │         "zip": null,
19:54:05 │ remix │         "province": null,
19:54:05 │ remix │         "country": "Canada",
19:54:05 │ remix │         "last_name": null,
19:54:05 │ remix │         "address2": null,
19:54:05 │ remix │         "company": null,
19:54:05 │ remix │         "latitude": null,
19:54:05 │ remix │         "longitude": null,
19:54:05 │ remix │         "name": "",
19:54:05 │ remix │         "country_code": "CA",
19:54:05 │ remix │         "province_code": null
19:54:05 │ remix │       },
19:54:05 │ remix │       "address2": null,
19:54:05 │ remix │       "address3": null,
19:54:05 │ remix │       "latitude": null,
19:54:05 │ remix │       "longitude": null,
19:54:05 │ remix │       "phone": null,
19:54:05 │ remix │       "fax": null,
19:54:05 │ remix │       "email": null,
19:54:05 │ remix │       "address_type": null,
19:54:05 │ remix │       "company_name": "no-sig-checkout"
19:54:05 │ remix │     },
19:54:05 │ remix │     "items": [
19:54:05 │ remix │       {
19:54:05 │ remix │         "name": "",
19:54:05 │ remix │         "sku": "XXXXXXXX",
19:54:05 │ remix │         "quantity": 1,
19:54:05 │ remix │         "grams": 100,
19:54:05 │ remix │         "price": 0,
19:54:05 │ remix │         "vendor": null,
19:54:05 │ remix │         "requires_shipping": true,
19:54:05 │ remix │         "taxable": true,
19:54:05 │ remix │         "fulfillment_service": "manual",
19:54:05 │ remix │         "properties": null,
19:54:05 │ remix │         "product_id": null,
19:54:05 │ remix │         "variant_id": null
19:54:05 │ remix │       }
19:54:05 │ remix │     ],
19:54:05 │ remix │     "currency": "CAD",
19:54:05 │ remix │     "locale": "en"
19:54:05 │ remix │   }
19:54:05 │ remix │ }

and then compare that against when I edit rates for international the data is provided:

Shopify Request Body:  {
20:10:26 │ remix │   "rate": {
20:10:26 │ remix │     "origin": {
20:10:26 │ remix │       "country": "CA",
20:10:26 │ remix │       "postal_code": null,
20:10:26 │ remix │       "province": null,
20:10:26 │ remix │       "city": null,
20:10:26 │ remix │       "name": "Shop location",
20:10:26 │ remix │       "address1": {
20:10:26 │ remix │         "first_name": null,
20:10:26 │ remix │         "address1": null,
20:10:26 │ remix │         "phone": null,
20:10:26 │ remix │         "city": null,
20:10:26 │ remix │         "zip": null,
20:10:26 │ remix │         "province": null,
20:10:26 │ remix │         "country": "Canada",
20:10:26 │ remix │         "last_name": null,
20:10:26 │ remix │         "address2": null,
20:10:26 │ remix │         "company": null,
20:10:26 │ remix │         "latitude": null,
20:10:26 │ remix │         "longitude": null,
20:10:26 │ remix │         "name": "",
20:10:26 │ remix │         "country_code": "CA",
20:10:26 │ remix │         "province_code": null
20:10:26 │ remix │       },
20:10:26 │ remix │       "address2": null,
20:10:26 │ remix │       "address3": null,
20:10:26 │ remix │       "latitude": null,
20:10:26 │ remix │       "longitude": null,
20:10:26 │ remix │       "phone": null,
20:10:26 │ remix │       "fax": null,
20:10:26 │ remix │       "email": null,
20:10:26 │ remix │       "address_type": null,
20:10:26 │ remix │       "company_name": "no-sig-checkout"
20:10:26 │ remix │     },
20:10:26 │ remix │     "destination": {
20:10:26 │ remix │       "country": "CH",
20:10:26 │ remix │       "postal_code": "2544",
20:10:26 │ remix │       "province": null,
20:10:26 │ remix │       "city": "rate test",
20:10:26 │ remix │       "name": null,
20:10:26 │ remix │       "address1": "rate test",
20:10:26 │ remix │       "address2": null,
20:10:26 │ remix │       "address3": null,
20:10:26 │ remix │       "latitude": null,
20:10:26 │ remix │       "longitude": null,
20:10:26 │ remix │       "phone": null,
20:10:26 │ remix │       "fax": null,
20:10:26 │ remix │       "email": null,
20:10:26 │ remix │       "address_type": null,
20:10:26 │ remix │       "company_name": null
20:10:26 │ remix │     },
20:10:26 │ remix │     "items": [
20:10:26 │ remix │       {
20:10:26 │ remix │         "name": "",
20:10:26 │ remix │         "sku": "XXXXXXXX",
20:10:26 │ remix │         "quantity": 1,
20:10:26 │ remix │         "grams": 100,
20:10:26 │ remix │         "price": 0,
20:10:26 │ remix │         "vendor": null,
20:10:26 │ remix │         "requires_shipping": true,
20:10:26 │ remix │         "taxable": true,
20:10:26 │ remix │         "fulfillment_service": "manual",
20:10:26 │ remix │         "properties": null,
20:10:26 │ remix │         "product_id": null,
20:10:26 │ remix │         "variant_id": null
20:10:26 │ remix │       }
20:10:26 │ remix │     ],
20:10:26 │ remix │     "currency": "CAD",
20:10:26 │ remix │     "locale": "en"
20:10:26 │ remix │   }
20:10:26 │ remix │ }

jasper91_0-1697069753551.pngjasper91_1-1697069794171.pngjasper91_2-1697069824132.png
Any insights are appreciated! Thanks

 

Replies 2 (2)

Liam
Shopify Staff
2731 302 783

Hi Jasper91,

 

This seems like an issue with the data that Shopify is sending to your app when you're editing rates for a shipping zone. If the postal code, city, province, etc are all null, that would indeed make it impossible to calculate accurate shipping rates for a given zone.

 

The same applies to the origin address, which also seems to be missing crucial information.

This could be an issue with how your app is setup to receive data from Shopify, but it's difficult to say without more information.

 

Here are a few things you could try to troubleshoot this issue:

  1. Re-check your app settings in Shopify: Ensure that you've set up your app correctly in Shopify, and that you've provided all the necessary information for it to receive data from Shopify. If there's a misconfiguration on this end, it could be causing the null values you're seeing.

  2. Test with different shipping zones: This issue might be specific to certain shipping zones. Try setting up rates for different zones and see if you're still experiencing this issue.

  3. Log the raw request data: If you're not doing this already, you could try logging the raw request that your app is receiving from Shopify. This might help you identify any issues with the data that's being sent to your app.

Remember to sanitize any sensitive data before you log it, especially if you're planning on sharing the logs with anyone else. Try the above and see if you can resolve the issue - if not, I'd recommend contacting support directly to see if they can dive deeper into this. 

 

Hope this helps,

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

jasper91
Shopify Partner
9 0 4

Hi Liam,

 

Thank you for quick response!

 

Unfortunately, those are the raw logs from Shopify. It seems to only happen with a Canadian address. I will have to contact support directly I think. 

 

Thank you