how to get lineitem compare at price field in exported orders

samir-growwx
Shopify Partner
6 0 2

 

When exporting orders, I noticed that the "line item compare at price" field for line items is empty. I have been creating orders through the API, and despite including the "compare_at_price" value in the line item, it does not appear in the exported order. However, when using the standard process of placing an order through the Shopify store, the "line item compare at price" is present in the exported order.

 

Here is the code snippet I have tried, including the relevant line item details, but it hasn't resolved the issue:

 
{
  "order": {
    "line_items": [
      {
        "variant_id": 1234567890,
        "quantity": 1,
        "price": "10.00",
        "compare_at_price": "15.00"
      }
    ]
  }
}

 

Reply 1 (1)
ShopifyDevSup
Shopify Staff
Shopify Staff
1200 190 418

Hi @samir-growwx to update the `compare_at_price` via the API you should use the Product Variant API. https://shopify.dev/docs/api/admin-rest/2023-04/resources/product-variant#:~:text=for%20the%20produc... It's not available to the orders API. Hope that helps. 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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