Hi Alan
Appreciate this is 2 years old now but I’m having a related problem whereby I’m not getting the correct refundableQuantity when exchanging an item, but I do if I straight return and refund an item.
My query looks like this:
query {
orders(first: 10, ${nextLink} query: "updated_at:>'${lastUpdatedISO}' AND return_status:returned") {
edges {
node {
id
email
customer {
firstName
lastName
}
updatedAt
lineItems(first: 10) {
edges {
node {
title
vendor
quantity
refundableQuantity
variant {
product {
id
}
selectedOptions {
name
value
}
}
}
}
}
}
cursor
}
pageInfo {
hasNextPage
endCursor
}
}
}
I’ve noticed an issue whereby if I do a simple refund, i.e. customer ordered 1 item, and then returned that item, everything works as expected and I get quantity: 1 and refundableQuantity: 0.
[
{
id: 'gid://shopify/Order/5669618811048',
email: 'XXX@XXX.com',
customer: { firstName: 'XXX', lastName: 'XXX' },
updatedAt: '2024-06-05T13:45:46Z',
lineItems: [
{
originalStoreId: 'gid://shopify/Product/7549745561768',
title: 'Alireza Houndstooth Trench Coat',
vendor: 'Hållbaren',
quantity: 1,
refundableQuantity: 0,
variant: {
product: { id: 'gid://shopify/Product/7549745561768' },
selectedOptions: [
{ name: 'Size', value: '6' },
{ name: 'Color', value: 'Black' },
],
},
},
],
},
];
However, the issue is when I exchange an item, i.e. the customer ordered 1 thing, returns it, and I add a new item to the order in it’s place, I end up with the original item showing quantity: 1 and refundableQuantity: 1 (should be 0), and the new item shows quantity: 1 and refundableQuantity: 1 (as expected). So I’m unable to tell which item was actually refunded here.
[
{
"id": "gid://shopify/Order/5658691436712",
"email": "XXX@XXX.com",
"customer": { "firstName": "XXX", "lastName": "XXX" },
"updatedAt": "2024-06-05T13:55:54Z",
"lineItems": [
{
"originalStoreId": "gid://shopify/Product/7549741039784",
"title": "Aiony Blazer", // THIS IS THE RETURNED ITEM
"vendor": "Hållbaren",
"quantity": 1,
"refundableQuantity": 1, // STILL SHOWING 1!?
"variant": {
"product": { "id": "gid://shopify/Product/7549741039784" },
"selectedOptions": [
{ "name": "Size", "value": "6" },
{ "name": "Color", "value": "Natural" }
]
}
},
{
"originalStoreId": "gid://shopify/Product/7549741039784",
"title": "Aiony Blazer", // THIS IS THE EXCHANGE ITEM
"vendor": "Hållbaren",
"quantity": 1,
"refundableQuantity": 1, // OK, AS EXPECTED
"variant": {
"product": { "id": "gid://shopify/Product/7549741039784" },
"selectedOptions": [
{ "name": "Size", "value": "8" },
{ "name": "Color", "value": "Natural" }
]
}
}
]
}
]
Cheers
Gary