Solved
Excursionist
31 2 1

## Shipping Zones Api delivers inconsistent results

Explanation of edge case scenario:

1. I set my shop's default weight unit to pounds.

2. I create a shipping rate for orders weighing 0 to 5 pounds, rate price is \$5

3. (later on) I change my shop's weight unit to ounces because most of my products are actually very small.

4. I create a new shipping rate for orders weighing 0 to 12 ounces, rate price is \$3

Now, an app that calculates shipping estimates needs to get the shipping zones, so that they can calculate an estimate. The app gets:

{
"price": "5.00",
"weight_low": null,
"weight_high": 5
},
{
"price": "3",
"weight_low": 0,
"weight_high": 12
}

And the response of the shop.json endpoint says the shop's weight unit is ounces, while the rates do not return what unit they're using ðŸ˜ž

Problem:

Are the rates for 5lb and 12lb? Or 5oz and 12oz?

Solution:

Accepted Solution (1)

Accepted Solutions
Excursionist
31 2 1

## Re: Shipping Zones Api delivers inconsistent results

This is an accepted solution.

I figured it out... Shipping Zones are already available in GraphQl, however they are named Delivery Profile:

Using GraphQl you can get the shipping zones setup with the necessary weight units and currency codes, both of which can be inconsistent between different rates.

Example:

``````{
deliveryProfiles(first:1) {
edges {
node {
profileLocationGroups {
locationGroupZones(first:10) {
edges {
node {
methodDefinitions(first:10, eligible: true) {
edges {
node {
active
name
methodConditions {
field
operator
conditionCriteria {
__typename
... on Weight {
value
unit
}
... on MoneyV2 {
amount
currencyCode
}
}
}
}
}
}
}
}
}
}
}
}
}
}``````

Replies 3 (3)
Excursionist
31 2 1

## Re: Shipping Zones Api delivers inconsistent results

Just wondering if there's any plan to address this issue?

Excursionist
31 2 1

## Re: Shipping Zones Api delivers inconsistent results

I'm guessing this could be improved once Shipping Zones become available in the GraphQL API? Any plan to improve add weight_unit to the rates before that?

Excursionist
31 2 1

## Re: Shipping Zones Api delivers inconsistent results

This is an accepted solution.

I figured it out... Shipping Zones are already available in GraphQl, however they are named Delivery Profile:

Using GraphQl you can get the shipping zones setup with the necessary weight units and currency codes, both of which can be inconsistent between different rates.

Example:

``````{
deliveryProfiles(first:1) {
edges {
node {
profileLocationGroups {
locationGroupZones(first:10) {
edges {
node {
methodDefinitions(first:10, eligible: true) {
edges {
node {
active
name
methodConditions {
field
operator
conditionCriteria {
__typename
... on Weight {
value
unit
}
... on MoneyV2 {
amount
currencyCode
}
}
}
}
}
}
}
}
}
}
}
}
}
}``````

Top Contributors
Community Browser