Hello everyone,
I’m developing a custom app for Shopify and I’m facing an issue when trying to calculate the shipping rate using the draftOrderCalculate mutation from Shopify’s GraphQL API.
When sending the request, the response I get has the shippingLine field as null, even though I’m providing all the necessary details, including the shipping address and the products.
I intend to calculate the shipping cost based on the rates I’ve already configured in Shopify, but I’m not getting the expected response.
Here’s an excerpt of what I’m sending to the API:
{
"query": "...",
"variables": {
"input": {
"shippingAddress": {
"address1": "direccion 1",
"city": "Santiago",
"countryCode": "CL",
"provinceCode": "RM",
"zip": "999995"
},
"lineItems": [
{
"variantId": "gid://shopify/ProductVariant/44175236006112",
"quantity": 1
},
{
"variantId": "gid://shopify/ProductVariant/44175236530400",
"quantity": 1
}
]
}
}
}
The response I get has the shippingLine field as null:
{
"data": {
"draftOrderCalculate": {
"calculatedDraftOrder": {
"shippingLine": null
},
"userErrors": []
}
}
}
I’ve verified that the shipping address and product details are correct. Also, I’m using the correct abbreviations for the provinceCode and countryCode.
Has anyone faced a similar issue or has any suggestions on what might be causing this? Is there something I might be overlooking or anything else I should try?
Thanks in advance for any help or suggestions!
Hola a todos,
Estoy desarrollando una aplicación personalizada para Shopify y estoy enfrentando un problema al intentar calcular la tarifa de envío usando la mutación draftOrderCalculate de la API de GraphQL de Shopify.
Al enviar la solicitud, la respuesta que recibo tiene el campo shippingLine como null, a pesar de que estoy proporcionando todos los detalles necesarios, incluyendo la dirección de envío y los productos.
Mi intención es que se calcule el costo de envío basado en las tarifas que ya tengo configuradas en Shopify, pero no estoy obteniendo la respuesta esperada.
Aquí está un extracto de lo que envío a la API:
{
"query": "...",
"variables": {
"input": {
"shippingAddress": {
"address1": "direccion 1",
"city": "Santiago",
"countryCode": "CL",
"provinceCode": "RM",
"zip": "999995"
},
"lineItems": [
{
"variantId": "gid://shopify/ProductVariant/44175236006112",
"quantity": 1
},
{
"variantId": "gid://shopify/ProductVariant/44175236530400",
"quantity": 1
}
]
}
}
}
Aquí está un extracto de la respuesta que recibo:
{
"data": {
"draftOrderCalculate": {
"calculatedDraftOrder": {
"shippingLine": null
},
"userErrors": []
}
}
}
He verificado que la dirección de envío y los detalles del producto sean correctos. Además, estoy usando las abreviaturas correctas para el provinceCode y el countryCode.
¿Alguien ha enfrentado un problema similar o tiene alguna sugerencia sobre qué podría estar causando esto? ¿Hay algo que pueda estar pasando por alto o alguna otra cosa que deba probar?
¡Gracias de antemano por cualquier ayuda o sugerencia!