Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Re: Unable to Identify Fields to Support Product Exchange Use-case

Unable to Identify Fields to Support Product Exchange Use-case

Avalara
Shopify Partner
13 0 5

Hi Shopify Support team,

 

We have built the Extractor for Shopify application which helps the seller to prepare their data for filling the returns. We used GET /orders  API to retrieve the sales and refund orders.

 

We are trying to support one of the use case which is reposted by one of the customer.

STEPS TO REPRODUCE :-

Order created with 2 products that is : OrderID : 4445409181739

  1. Test Product 1 (QTY : 5) -> price = $50
  2. Test Product 2 (QTY : 2)-> price = $40
  3. Please see the attached screenshot names as "Screenshot1"

Clicked on Edit ->(Exchange use-case)

  1. Added one more product ->Test Product 1(QTY : 1) -> price = $10
  2. Removed one product ->Test Product 1(QTY : 1) -> price = $10
  3. Order has updated with no additional payment/Refund.
  4. Please see the attached screenshot names as "Screenshot2"

PROBLEM STATEMENT :-

Sales Amount ->

  • We need to extract data line items wise ( we take "line_items" to considerations )from each order. We are considering below calculations/fields to get sales amount , sales Tax and shipping amount

 line_items ->let lineItem is each lines of line_items then salesAmount is summatios of each line's (lineItem.price *lineItem.quantity) in "line_items" property.

Sales Tax ->

We retrive the sales Tax detatils for Each Line items from "tax_lines" proterty which is present at each "line-items".

Shipping Amount:

 We retrieve the shipping amount details from "shipping_lines" property.

While re-prodcuing this use-case, we have identified that the new lineitems is getting created in "line_items" property due to which we are extracting total three lines even if there should be two valid newlines because One of them has removed.

Test Product 1 (QTY : 4) -> price = $50 ( 1 QTY has removed)

Test Product 2 (QTY : 2)-> price = $40

Test Product 1 (QTY : 1) -> price = $10( 1 QTY has added)

Test Product 1 (QTY : 5) -> price = $50 ( 1 QTY has removed)

Test Product 2 (QTY : 2)-> price = $40

Test Product 1 (QTY : 1) -> price = $10( 1 QTY has added)

  1. Total valid  lines visible in shopify UI:-
  2. As per our existing logic we are pulling total 3 lines :-
  3. If you see the above details we are unable to identify the item which has been removed from Orders API ,however we are extracting all the line_items even though one of them has been removed..When we have tried to generate order's report from shopify admin portal, UI report has those adjustment.

QUESTION ?

Could you please help us ,How we can Identify and support this use-case using Orders API?

 

Please let us know if you need more details.

 

FYR Order (4445409181739) created API response: -

{
    "order": {
        "id": 4445409181739,
        "admin_graphql_api_id": "gid://shopify/Order/4445409181739",
        "app_id": 1354745,
        "browser_ip": null,
        "buyer_accepts_marketing": false,
        "cancel_reason": null,
        "cancelled_at": null,
        "cart_token": null,
        "checkout_id": 26120219820075,
        "checkout_token": "fa02b46933307eb524d1d2091dccca8f",
        "client_details": {
            "accept_language": null,
            "browser_height": null,
            "browser_ip": null,
            "browser_width": null,
            "session_hash": null,
            "user_agent": null
        },
        "closed_at": null,
        "confirmed": true,
        "contact_email": null,
        "created_at": "2022-10-12T15:07:26+05:30",
        "currency": "USD",
        "current_subtotal_price": "90.00",
        "current_subtotal_price_set": {
            "shop_money": {
                "amount": "90.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "90.00",
                "currency_code": "USD"
            }
        },
        "current_total_discounts": "0.00",
        "current_total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "USD"
            }
        },
        "current_total_duties_set": null,
        "current_total_price": "109.20",
        "current_total_price_set": {
            "shop_money": {
                "amount": "109.20",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "109.20",
                "currency_code": "USD"
            }
        },
        "current_total_tax": "9.20",
        "current_total_tax_set": {
            "shop_money": {
                "amount": "9.20",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "9.20",
                "currency_code": "USD"
            }
        },
        "customer_locale": null,
        "device_id": null,
        "discount_codes": [],
        "email": "",
        "estimated_taxes": false,
        "financial_status": "paid",
        "fulfillment_status": null,
        "gateway": "manual",
        "landing_site": null,
        "landing_site_ref": null,
        "location_id": 63411781675,
        "name": "#1030",
        "note": null,
        "note_attributes": [],
        "number": 30,
        "order_number": 1030,
        "order_status_url": "https://chetans-gift-card-store-50-character-wala-store-created-and.myshopify.com/57714376747/orders/80ad883f93bc9a3fa50940b2fd91fdba/authenticate?key=4121dcdb452c29fb15df1a5a54c7d450",
        "original_total_duties_set": null,
        "payment_gateway_names": [
            "manual"
        ],
        "phone": null,
        "presentment_currency": "USD",
        "processed_at": "2022-10-12T15:07:26+05:30",
        "processing_method": "manual",
        "reference": null,
        "referring_site": null,
        "source_identifier": null,
        "source_name": "shopify_draft_order",
        "source_url": null,
        "subtotal_price": "90.00",
        "subtotal_price_set": {
            "shop_money": {
                "amount": "90.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "90.00",
                "currency_code": "USD"
            }
        },
        "tags": "",
        "tax_lines": [
            {
                "price": "2.70",
                "rate": 0.027,
                "title": "Bainbridge Island City Tax",
                "price_set": {
                    "shop_money": {
                        "amount": "2.70",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "2.70",
                        "currency_code": "USD"
                    }
                },
                "channel_liable": false
            },
            {
                "price": "6.50",
                "rate": 0.065,
                "title": "Washington State Tax",
                "price_set": {
                    "shop_money": {
                        "amount": "6.50",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "6.50",
                        "currency_code": "USD"
                    }
                },
                "channel_liable": false
            }
        ],
        "taxes_included": false,
        "test": false,
        "token": "80ad883f93bc9a3fa50940b2fd91fdba",
        "total_discounts": "0.00",
        "total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "USD"
            }
        },
        "total_line_items_price": "90.00",
        "total_line_items_price_set": {
            "shop_money": {
                "amount": "90.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "90.00",
                "currency_code": "USD"
            }
        },
        "total_outstanding": "0.00",
        "total_price": "109.20",
        "total_price_set": {
            "shop_money": {
                "amount": "109.20",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "109.20",
                "currency_code": "USD"
            }
        },
        "total_price_usd": "109.20",
        "total_shipping_price_set": {
            "shop_money": {
                "amount": "10.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "10.00",
                "currency_code": "USD"
            }
        },
        "total_tax": "9.20",
        "total_tax_set": {
            "shop_money": {
                "amount": "9.20",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "9.20",
                "currency_code": "USD"
            }
        },
        "total_tip_received": "0.00",
        "total_weight": 0,
        "updated_at": "2022-10-12T15:07:27+05:30",
        "user_id": 75334909995,
        "discount_applications": [],
        "fulfillments": [],
        "line_items": [
            {
                "id": 11228849537067,
                "admin_graphql_api_id": "gid://shopify/LineItem/11228849537067",
                "fulfillable_quantity": 5,
                "fulfillment_service": "manual",
                "fulfillment_status": null,
                "gift_card": false,
                "grams": 0,
                "name": "Test Product 1",
                "origin_location": {
                    "id": 3343165915179,
                    "country_code": "US",
                    "province_code": "WA",
                    "name": "900 winslow way e",
                    "address1": "900 winslow way e",
                    "address2": "",
                    "city": "BI",
                    "zip": "98110"
                },
                "price": "10.00",
                "price_set": {
                    "shop_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    }
                },
                "product_exists": false,
                "product_id": null,
                "properties": [],
                "quantity": 5,
                "requires_shipping": true,
                "sku": null,
                "taxable": true,
                "title": "Test Product 1",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    }
                },
                "variant_id": null,
                "variant_inventory_management": null,
                "variant_title": "",
                "vendor": null,
                "tax_lines": [
                    {
                        "channel_liable": false,
                        "price": "3.25",
                        "price_set": {
                            "shop_money": {
                                "amount": "3.25",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "3.25",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.065,
                        "title": "Washington State Tax"
                    },
                    {
                        "channel_liable": false,
                        "price": "1.35",
                        "price_set": {
                            "shop_money": {
                                "amount": "1.35",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "1.35",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.027,
                        "title": "Bainbridge Island City Tax"
                    }
                ],
                "duties": [],
                "discount_allocations": []
            },
            {
                "id": 11228849569835,
                "admin_graphql_api_id": "gid://shopify/LineItem/11228849569835",
                "fulfillable_quantity": 2,
                "fulfillment_service": "manual",
                "fulfillment_status": null,
                "gift_card": false,
                "grams": 0,
                "name": "Test Product 2",
                "origin_location": {
                    "id": 3343165915179,
                    "country_code": "US",
                    "province_code": "WA",
                    "name": "900 winslow way e",
                    "address1": "900 winslow way e",
                    "address2": "",
                    "city": "BI",
                    "zip": "98110"
                },
                "price": "20.00",
                "price_set": {
                    "shop_money": {
                        "amount": "20.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "20.00",
                        "currency_code": "USD"
                    }
                },
                "product_exists": false,
                "product_id": null,
                "properties": [],
                "quantity": 2,
                "requires_shipping": true,
                "sku": null,
                "taxable": true,
                "title": "Test Product 2",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    }
                },
                "variant_id": null,
                "variant_inventory_management": null,
                "variant_title": "",
                "vendor": null,
                "tax_lines": [
                    {
                        "channel_liable": false,
                        "price": "2.60",
                        "price_set": {
                            "shop_money": {
                                "amount": "2.60",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "2.60",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.065,
                        "title": "Washington State Tax"
                    },
                    {
                        "channel_liable": false,
                        "price": "1.08",
                        "price_set": {
                            "shop_money": {
                                "amount": "1.08",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "1.08",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.027,
                        "title": "Bainbridge Island City Tax"
                    }
                ],
                "duties": [],
                "discount_allocations": []
            }
        ],
        "payment_terms": null,
        "refunds": [],
        "shipping_lines": [
            {
                "id": 3750685769771,
                "carrier_identifier": null,
                "code": "custom",
                "delivery_category": null,
                "discounted_price": "10.00",
                "discounted_price_set": {
                    "shop_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    }
                },
                "phone": null,
                "price": "10.00",
                "price_set": {
                    "shop_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    }
                },
                "requested_fulfillment_service_id": null,
                "source": "shopify",
                "title": "test",
                "tax_lines": [
                    {
                        "channel_liable": false,
                        "price": "0.65",
                        "price_set": {
                            "shop_money": {
                                "amount": "0.65",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "0.65",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.065,
                        "title": "Washington State Tax"
                    },
                    {
                        "channel_liable": false,
                        "price": "0.27",
                        "price_set": {
                            "shop_money": {
                                "amount": "0.27",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "0.27",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.027,
                        "title": "Bainbridge Island City Tax"
                    }
                ],
                "discount_allocations": []
            }
        ]
    }
}

Order (4445409181739) Updated API response :

{
        "id": 4445409181739,
        "admin_graphql_api_id": "gid://shopify/Order/4445409181739",
        "app_id": 1354745,
        "browser_ip": null,
        "buyer_accepts_marketing": false,
        "cancel_reason": null,
        "cancelled_at": null,
        "cart_token": null,
        "checkout_id": 26120219820075,
        "checkout_token": "fa02b46933307eb524d1d2091dccca8f",
        "client_details": {
            "accept_language": null,
            "browser_height": null,
            "browser_ip": null,
            "browser_width": null,
            "session_hash": null,
            "user_agent": null
        },
        "closed_at": null,
        "confirmed": true,
        "contact_email": null,
        "created_at": "2022-10-12T15:07:26+05:30",
        "currency": "USD",
        "current_subtotal_price": "90.00",
        "current_subtotal_price_set": {
            "shop_money": {
                "amount": "90.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "90.00",
                "currency_code": "USD"
            }
        },
        "current_total_discounts": "0.00",
        "current_total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "USD"
            }
        },
        "current_total_duties_set": null,
        "current_total_price": "109.20",
        "current_total_price_set": {
            "shop_money": {
                "amount": "109.20",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "109.20",
                "currency_code": "USD"
            }
        },
        "current_total_tax": "9.20",
        "current_total_tax_set": {
            "shop_money": {
                "amount": "9.20",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "9.20",
                "currency_code": "USD"
            }
        },
        "customer_locale": null,
        "device_id": null,
        "discount_codes": [],
        "email": "",
        "estimated_taxes": false,
        "financial_status": "paid",
        "fulfillment_status": null,
        "gateway": "manual",
        "landing_site": null,
        "landing_site_ref": null,
        "location_id": 63411781675,
        "name": "#1030",
        "note": null,
        "note_attributes": [],
        "number": 30,
        "order_number": 1030,
        "order_status_url": "https://chetans-gift-card-store-50-character-wala-store-created-and.myshopify.com/57714376747/orders/80ad883f93bc9a3fa50940b2fd91fdba/authenticate?key=4121dcdb452c29fb15df1a5a54c7d450",
        "original_total_duties_set": null,
        "payment_gateway_names": [
            "manual"
        ],
        "phone": null,
        "presentment_currency": "USD",
        "processed_at": "2022-10-12T15:07:26+05:30",
        "processing_method": "manual",
        "reference": null,
        "referring_site": null,
        "source_identifier": null,
        "source_name": "shopify_draft_order",
        "source_url": null,
        "subtotal_price": "100.00",
        "subtotal_price_set": {
            "shop_money": {
                "amount": "100.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "100.00",
                "currency_code": "USD"
            }
        },
        "tags": "",
        "tax_lines": [
            {
                "price": "2.97",
                "rate": 0.027,
                "title": "Bainbridge Island City Tax",
                "price_set": {
                    "shop_money": {
                        "amount": "2.97",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "2.97",
                        "currency_code": "USD"
                    }
                },
                "channel_liable": false
            },
            {
                "price": "7.15",
                "rate": 0.065,
                "title": "Washington State Tax",
                "price_set": {
                    "shop_money": {
                        "amount": "7.15",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "7.15",
                        "currency_code": "USD"
                    }
                },
                "channel_liable": false
            }
        ],
        "taxes_included": false,
        "test": false,
        "token": "80ad883f93bc9a3fa50940b2fd91fdba",
        "total_discounts": "0.00",
        "total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "USD"
            }
        },
        "total_line_items_price": "100.00",
        "total_line_items_price_set": {
            "shop_money": {
                "amount": "100.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "100.00",
                "currency_code": "USD"
            }
        },
        "total_outstanding": "0.00",
        "total_price": "120.12",
        "total_price_set": {
            "shop_money": {
                "amount": "120.12",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "120.12",
                "currency_code": "USD"
            }
        },
        "total_price_usd": "120.12",
        "total_shipping_price_set": {
            "shop_money": {
                "amount": "10.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "10.00",
                "currency_code": "USD"
            }
        },
        "total_tax": "10.12",
        "total_tax_set": {
            "shop_money": {
                "amount": "10.12",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "10.12",
                "currency_code": "USD"
            }
        },
        "total_tip_received": "0.00",
        "total_weight": 0,
        "updated_at": "2022-10-12T15:14:30+05:30",
        "user_id": 75334909995,
        "discount_applications": [],
        "fulfillments": [],
        "line_items": [
            {
                "id": 11228849537067,
                "admin_graphql_api_id": "gid://shopify/LineItem/11228849537067",
                "fulfillable_quantity": 4,
                "fulfillment_service": "manual",
                "fulfillment_status": null,
                "gift_card": false,
                "grams": 0,
                "name": "Test Product 1",
                "origin_location": {
                    "id": 3343165915179,
                    "country_code": "US",
                    "province_code": "WA",
                    "name": "900 winslow way e",
                    "address1": "900 winslow way e",
                    "address2": "",
                    "city": "BI",
                    "zip": "98110"
                },
                "price": "10.00",
                "price_set": {
                    "shop_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    }
                },
                "product_exists": false,
                "product_id": null,
                "properties": [],
                "quantity": 5,
                "requires_shipping": true,
                "sku": null,
                "taxable": true,
                "title": "Test Product 1",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    }
                },
                "variant_id": null,
                "variant_inventory_management": null,
                "variant_title": "",
                "vendor": null,
                "tax_lines": [
                    {
                        "channel_liable": false,
                        "price": "3.25",
                        "price_set": {
                            "shop_money": {
                                "amount": "3.25",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "3.25",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.065,
                        "title": "Washington State Tax"
                    },
                    {
                        "channel_liable": false,
                        "price": "1.35",
                        "price_set": {
                            "shop_money": {
                                "amount": "1.35",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "1.35",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.027,
                        "title": "Bainbridge Island City Tax"
                    }
                ],
                "duties": [],
                "discount_allocations": []
            },
            {
                "id": 11228849569835,
                "admin_graphql_api_id": "gid://shopify/LineItem/11228849569835",
                "fulfillable_quantity": 2,
                "fulfillment_service": "manual",
                "fulfillment_status": null,
                "gift_card": false,
                "grams": 0,
                "name": "Test Product 2",
                "origin_location": {
                    "id": 3343165915179,
                    "country_code": "US",
                    "province_code": "WA",
                    "name": "900 winslow way e",
                    "address1": "900 winslow way e",
                    "address2": "",
                    "city": "BI",
                    "zip": "98110"
                },
                "price": "20.00",
                "price_set": {
                    "shop_money": {
                        "amount": "20.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "20.00",
                        "currency_code": "USD"
                    }
                },
                "product_exists": false,
                "product_id": null,
                "properties": [],
                "quantity": 2,
                "requires_shipping": true,
                "sku": null,
                "taxable": true,
                "title": "Test Product 2",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    }
                },
                "variant_id": null,
                "variant_inventory_management": null,
                "variant_title": "",
                "vendor": null,
                "tax_lines": [
                    {
                        "channel_liable": false,
                        "price": "2.60",
                        "price_set": {
                            "shop_money": {
                                "amount": "2.60",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "2.60",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.065,
                        "title": "Washington State Tax"
                    },
                    {
                        "channel_liable": false,
                        "price": "1.08",
                        "price_set": {
                            "shop_money": {
                                "amount": "1.08",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "1.08",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.027,
                        "title": "Bainbridge Island City Tax"
                    }
                ],
                "duties": [],
                "discount_allocations": []
            },
            {
                "id": 11228858056747,
                "admin_graphql_api_id": "gid://shopify/LineItem/11228858056747",
                "fulfillable_quantity": 1,
                "fulfillment_service": "manual",
                "fulfillment_status": null,
                "gift_card": false,
                "grams": 0,
                "name": "Test Product 1",
                "price": "10.00",
                "price_set": {
                    "shop_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    }
                },
                "product_exists": false,
                "product_id": null,
                "properties": [],
                "quantity": 1,
                "requires_shipping": false,
                "sku": null,
                "taxable": true,
                "title": "Test Product 1",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    }
                },
                "variant_id": null,
                "variant_inventory_management": null,
                "variant_title": null,
                "vendor": null,
                "tax_lines": [
                    {
                        "channel_liable": false,
                        "price": "0.65",
                        "price_set": {
                            "shop_money": {
                                "amount": "0.65",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "0.65",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.065,
                        "title": "Washington State Tax"
                    },
                    {
                        "channel_liable": false,
                        "price": "0.27",
                        "price_set": {
                            "shop_money": {
                                "amount": "0.27",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "0.27",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.027,
                        "title": "Bainbridge Island City Tax"
                    }
                ],
                "duties": [],
                "discount_allocations": []
            }
        ],
        "payment_terms": null,
        "refunds": [
            {
                "id": 843093803051,
                "admin_graphql_api_id": "gid://shopify/Refund/843093803051",
                "created_at": "2022-10-12T15:14:29+05:30",
                "note": null,
                "order_id": 4445409181739,
                "processed_at": "2022-10-12T15:14:29+05:30",
                "restock": false,
                "total_duties_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    }
                },
                "user_id": 75334909995,
                "order_adjustments": [],
                "transactions": [],
                "refund_line_items": [
                    {
                        "id": 344247468075,
                        "line_item_id": 11228849537067,
                        "location_id": null,
                        "quantity": 1,
                        "restock_type": "no_restock",
                        "subtotal": 10.0,
                        "subtotal_set": {
                            "shop_money": {
                                "amount": "10.00",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "10.00",
                                "currency_code": "USD"
                            }
                        },
                        "total_tax": 0.92,
                        "total_tax_set": {
                            "shop_money": {
                                "amount": "0.92",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "0.92",
                                "currency_code": "USD"
                            }
                        },
                        "line_item": {
                            "id": 11228849537067,
                            "admin_graphql_api_id": "gid://shopify/LineItem/11228849537067",
                            "fulfillable_quantity": 4,
                            "fulfillment_service": "manual",
                            "fulfillment_status": null,
                            "gift_card": false,
                            "grams": 0,
                            "name": "Test Product 1",
                            "origin_location": {
                                "id": 3343165915179,
                                "country_code": "US",
                                "province_code": "WA",
                                "name": "900 winslow way e",
                                "address1": "900 winslow way e",
                                "address2": "",
                                "city": "BI",
                                "zip": "98110"
                            },
                            "price": "10.00",
                            "price_set": {
                                "shop_money": {
                                    "amount": "10.00",
                                    "currency_code": "USD"
                                },
                                "presentment_money": {
                                    "amount": "10.00",
                                    "currency_code": "USD"
                                }
                            },
                            "product_exists": false,
                            "product_id": null,
                            "properties": [],
                            "quantity": 5,
                            "requires_shipping": true,
                            "sku": null,
                            "taxable": true,
                            "title": "Test Product 1",
                            "total_discount": "0.00",
                            "total_discount_set": {
                                "shop_money": {
                                    "amount": "0.00",
                                    "currency_code": "USD"
                                },
                                "presentment_money": {
                                    "amount": "0.00",
                                    "currency_code": "USD"
                                }
                            },
                            "variant_id": null,
                            "variant_inventory_management": null,
                            "variant_title": "",
                            "vendor": null,
                            "tax_lines": [
                                {
                                    "channel_liable": false,
                                    "price": "3.25",
                                    "price_set": {
                                        "shop_money": {
                                            "amount": "3.25",
                                            "currency_code": "USD"
                                        },
                                        "presentment_money": {
                                            "amount": "3.25",
                                            "currency_code": "USD"
                                        }
                                    },
                                    "rate": 0.065,
                                    "title": "Washington State Tax"
                                },
                                {
                                    "channel_liable": false,
                                    "price": "1.35",
                                    "price_set": {
                                        "shop_money": {
                                            "amount": "1.35",
                                            "currency_code": "USD"
                                        },
                                        "presentment_money": {
                                            "amount": "1.35",
                                            "currency_code": "USD"
                                        }
                                    },
                                    "rate": 0.027,
                                    "title": "Bainbridge Island City Tax"
                                }
                            ],
                            "duties": [],
                            "discount_allocations": []
                        }
                    }
                ],
                "duties": []
            }
        ],
        "shipping_lines": [
            {
                "id": 3750685769771,
                "carrier_identifier": null,
                "code": "custom",
                "delivery_category": null,
                "discounted_price": "10.00",
                "discounted_price_set": {
                    "shop_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    }
                },
                "phone": null,
                "price": "10.00",
                "price_set": {
                    "shop_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "10.00",
                        "currency_code": "USD"
                    }
                },
                "requested_fulfillment_service_id": null,
                "source": "shopify",
                "title": "test",
                "tax_lines": [
                    {
                        "channel_liable": false,
                        "price": "0.65",
                        "price_set": {
                            "shop_money": {
                                "amount": "0.65",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "0.65",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.065,
                        "title": "Washington State Tax"
                    },
                    {
                        "channel_liable": false,
                        "price": "0.27",
                        "price_set": {
                            "shop_money": {
                                "amount": "0.27",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "0.27",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.027,
                        "title": "Bainbridge Island City Tax"
                    }
                ],
                "discount_allocations": []
            }
        ]
    }

ScreenShot1ScreenShot1ScreenShot2ScreenShot2

Replies 3 (3)

Umiko
Shopify Staff
42 8 14

Hi @Avalara 👋

 

None of the products in this order appears to have `variant_id` in which case, the line items would not be able to consolidate as you'd like. It's also unclear which `line_item_id` was passed when the refund was created. To avoid this in the future, I would recommend being very explicit with the `line_item_id` when making changes to an order with custom products that do not have a `variant_id`.

 

Hope that helps!

Umiko | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Avalara
Shopify Partner
13 0 5

Hi Umiko

 

We have created one more order with valid variant-Id still facing the same issue.

 

We are trying to identify fields for exchange product(post order creation remove one of the existing product and add new product with same/different variant(size/color) and make sure while updating the order the adjustment order should be 0) usecase.

 

How can we Identify this adjustment using orders API?

Umiko
Shopify Staff
42 8 14

We have a guide here to edit existing orders with Admin GraphQL API. To update edit line items on an existing order, you will need to use the GraphQL mutations since for Admin REST API, the docs highlight here that the order update endpoint is not intended for editing the items of an order. 

Umiko | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog