Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: draftOrderCalculate doesn't provide availableShippingRates for Standard International

draftOrderCalculate doesn't provide availableShippingRates for Standard International

rkmsoftware
Shopify Partner
17 2 4

I am trying to get a shipping rate for the order before checkout using draftorderCalculate But when I add the country code except for default once, the result shows null for me.

{
  "input": {
    "email": "gulshan@xxxxx.net",
    "lineItems": [
      {
        "originalUnitPrice": "1.25",
        "quantity": 1,
        "requiresShipping": true,
        "sku": "BJxxx",
        "taxable": false,
        "title": "1-9 Number Puzzles",
        "variantId": "gid://shopify/ProductVariant/4310787820xxxx"
      }
    ],
    "shippingAddress": {
      "address1": "Fake city",
      "city": "dublin",
      "provinceCode":"Carlow",
      "countryCode": "IE",
      "firstName": "Gulshan",
      "lastName": "Sharma",
      "zip": "A91X2R3"
    },
    "useCustomerDefaultAddress": false
  }
}

Result:

{
  "data": {
    "draftOrderCalculate": {
      "calculatedDraftOrder": {
        "totalShippingPrice": "0.00",
        "availableShippingRates": []
      },
      "userErrors": []
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 11,
      "actualQueryCost": 11,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 989,
        "restoreRate": 50
      }
    }
  }
}

 

The shipping rate for Standard International is set as 14.99.

Please let me know if anyone has any suggestions.

Regards

Replies 3 (3)

juustanotherdev
Tourist
8 1 2

Hey @rkmsoftware,

 

Do you found any solution?

I am experiencing the same problem right now and don't really know how to continue.

 

Kind regards

rkmsoftware
Shopify Partner
17 2 4

You can you draftOrderCalculate mutation from Shopify graphQL. Which provides you with all the information you will get while checkout including the shipping price

juustanotherdev
Tourist
8 1 2

Thanks for the fast reply! 

I will try it with your suggested approach.