Hi,
I have used draftOrderCalculate admin API (https://shopify.dev/docs/api/admin-graphql/2023-07/mutations/draftOrderCalculate)) to test for my shipping rates, below is an example
POST /admin/api/2023-07/graphql.json HTTP/1.1
Host: HOSTNAME
X-Shopify-Access-Token: ACCESSTOKEN
Content-Type: application/graphql
Content-Length: 1554
mutation draftOrderCalculate{
draftOrderCalculate( input: {
purchasingEntity: {
customerId: "gid://shopify/Customer/CUSTOMERID"
}
lineItems: [
{
customAttributes: {
key: "KEY",
value: "VALUE"
},
variantId: "gid://shopify/ProductVariant/VARIANTID",
quantity: 1,
requiresShipping: true
}
]
shippingAddress: {
address1: "1111662",
address2: "0000006",
city: "Petaling Jaya",
country: "Malaysia",
province: "Selangor",
zip: "50000"
}
}
){
calculatedDraftOrder{
phone
customer{
id
email
}
lineItems{
name
customAttributesV2{
key
value
}
requiresShipping
}
availableShippingRates{
handle
price{
amount
currencyCode
}
title
}
subtotalPrice
totalTax
totalShippingPrice
totalPrice
}
userErrors {
field
message
}
}
}
The request is successful, but problem is, the lineItems customAttributes was not set.
This is the request body from Shopify:
{
"rate": {
"origin": {
"country": "MY",
"postal_code": "50450",
"province": "KUL",
"city": "Kuala Lumpur",
"name": null,
"address1": "ADDRESS1",
"address2": "",
"address3": null,
"latitude": 3.1593433,
"longitude": 101.7468678,
"phone": "",
"fax": null,
"email": null,
"address_type": null,
"company_name": "Village Grocer - M City"
},
"destination": {
"country": "MY",
"postal_code": "50000",
"province": "SGR",
"city": "Petaling Jaya",
"name": null,
"address1": "1111362",
"address2": "0000003",
"address3": null,
"latitude": null,
"longitude": null,
"phone": null,
"fax": null,
"email": null,
"address_type": null,
"company_name": null
},
"items": [
{
"name": "PRODUCT NAME",
"sku": "1000584",
"quantity": 1,
"grams": 300,
"price": 170,
"vendor": "VENDOR",
"requires_shipping": true,
"taxable": null,
"fulfillment_service": "manual",
"properties": {}, // not set
"product_id": 5609588359326,
"variant_id": 35830533587102
}
],
"currency": "MYR",
"locale": "en"
}
}
My question is, is this the correct way to set properties for lineItems?
If this is the correct way, may i know why its not working?