← back to Shopify Sample Shipping
cancel-test-order.mjs
17 lines
// One-command UNDO for the TK-11333 test orders: cancel (unpaid) then delete the record.
import {query} from './query.mjs';
const ORDERS=[
'gid://shopify/Order/6141633069107', // #33047 free-shipping proof
'gid://shopify/Order/6141644046387', // #33048 bulk designer, fees incur
'gid://shopify/Order/6141651812403', // #33049 8 distinct samples, free @ $45 band
'gid://shopify/Order/6141669703731', // #33050 info@dw interior_designer, 3 samples, free shipping
];
for(const id of ORDERS){
const c=`mutation($id:ID!){orderCancel(orderId:$id,reason:OTHER,refund:false,restock:true,notifyCustomer:false,staffNote:"TK-11333 test order teardown"){userErrors{field message}}}`;
const cr=await query(c,{id});
console.log(id,'cancel:',JSON.stringify(cr.orderCancel?.userErrors||cr));
const d=`mutation($id:ID!){orderDelete(orderId:$id){deletedId userErrors{field message}}}`;
const dr=await query(d,{id});
console.log(id,'delete:',JSON.stringify(dr.orderDelete));
}