Shopify Order Api discount not showing for the Product in api response

Shopify Order Api discount not showing for the Product in api response

RafiDeveloper
Shopify Partner
1 0 0

Hi  Shopify Support,

 

I am facing a issue over the shopify store with the order api response I have product for which there is compare price as 990 and there is sale price of 890   And order is made with shopify end .

RafiDeveloper_0-1745832191232.png

 

 

 

But  the response that I get from shopify order api in json is this  do not conatin any paramerter that will let me know the compared price of product that was ordered and also anything that will let me know that this product have difference in compared and sale price I required that information because I am working with other api where I have to post the dicount 

{
    "current_subtotal_price": "890.00",
    "current_subtotal_price_set": {
        "shop_money": {
            "amount": "890.00",
        },
        "presentment_money": {
            "amount": "890.00",
        }
    },
    "current_total_additional_fees_set": null,
    "current_total_discounts": "50.00",
    "current_total_discounts_set": {
        "shop_money": {
            "amount": "50.00",
        },
        "presentment_money": {
            "amount": "50.00",
        }
    },
    "current_total_duties_set": null,
    "current_total_price": "890.00",
    "current_total_price_set": {
        "shop_money": {
            "amount": "890.00",
        },
        "presentment_money": {
            "amount": "890.00",
        }
    },
    "current_total_tax": "135.76",
    "current_total_tax_set": {
        "shop_money": {
            "amount": "135.76",
        },
        "presentment_money": {
            "amount": "135.76",
        }
    },
 
    "discount_codes": [],
    "subtotal_price": "890.00",
    "subtotal_price_set": {
        "shop_money": {
            "amount": "890.00",
         
        },
        "presentment_money": {
            "amount": "890.00",
           
        }
    },
    "tags": "",
    "tax_exempt": false,
    "tax_lines": [
        {
            "price": "135.76",
            "rate": 0.18,
            "title": "VAT",
            "price_set": {
                "shop_money": {
                    "amount": "135.76",
                 
                },
                "presentment_money": {
                    "amount": "135.76",
                    
                }
            },
            "channel_liable": false
        }
    ],
 
    "total_discounts": "50.00",
    "total_discounts_set": {
        "shop_money": {
            "amount": "50.00",
         
        },
        "presentment_money": {
            "amount": "50.00",
            
        }
    },
    "total_line_items_price": "890.00",
    "total_line_items_price_set": {
        "shop_money": {
            "amount": "890.00",
           
        },
        "presentment_money": {
            "amount": "890.00",
           
        }
    },
    "total_outstanding": "0.00",
    "total_price": "890.00",
    "total_price_set": {
        "shop_money": {
            "amount": "890.00",
            
        },
        "presentment_money": {
            "amount": "890.00",
         
        }
    },
    "total_shipping_price_set": {
        "shop_money": {
            "amount": "50.00",
          
        },
        "presentment_money": {
            "amount": "50.00",
           
        }
    },
    "total_tax": "135.76",
    "total_tax_set": {
        "shop_money": {
            "amount": "135.76",
           
        },
        "presentment_money": {
            "amount": "135.76",
          
        }
    },
    "total_tip_received": "0.00",
    "total_weight": 0,
   
    },
    "discount_applications": [
        {
            "target_type": "shipping_line",
           
            "value": "100.0",
            "value_type": "percentage",
            "allocation_method": "each",
            "target_selection": "all",
            
        }
    ],
    "fulfillments": [],
    "line_items": [
        {
            "attributed_staffs": [],
            "fulfillment_service": "",
            "fulfillment_status": null,
            "grams": 0,
            "name": "xyz",
            "price": "890.00",
            "price_set": {
                "shop_money": {
                    "amount": "890.00",
                    
                },
                "presentment_money": {
                    "amount": "890.00",
                 
                }
            },
            "properties": [],
            "quantity": 1,
            "requires_shipping": true,
            "taxable": true,
            "title": "xyz",
            "total_discount": "0.00",
            "total_discount_set": {
                "shop_money": {
                    "amount": "0.00",
               
                },
                "presentment_money": {
                    "amount": "0.00",
                  
                }
            },
            "variant_inventory_management": "",
            "variant_title": "xy",
            "tax_lines": [
                {
                    "price": "135.76",
                    "price_set": {
                        "shop_money": {
                            "amount": "135.76",
                        
                        },
                        "presentment_money": {
                            "amount": "135.76",
                         
                        }
                    },
                    "rate": 0.18,
                    "title": "VAT"
                }
            ],
            "duties": [],
            "discount_allocations": []
        }
    ],
    "payment_terms": null,
    "refunds": [],
    "shipping_address": {
       
    },
    "shipping_lines": [
        {
            "code": "Standard",
            "discounted_price": "50.00",
            "discounted_price_set": {
                "shop_money": {
                    "amount": "50.00",
                  
                },
                "presentment_money": {
                    "amount": "50.00",
                  
                }
            },
            "price": "50.00",
            "price_set": {
                "shop_money": {
                    "amount": "50.00",
                 
                },
                "presentment_money": {
                    "amount": "50.00",
                    
                }
            },
            "requested_fulfillment_service_id": null,
            "source": "shopify",
            "title": "***",
            "tax_lines": [],
            "discount_allocations": [
                {
                    "amount": "50.00",
                    "amount_set": {
                        "shop_money": {
                            "amount": "50.00",
                        
                        },
                        "presentment_money": {
                            "amount": "50.00",
                           
                        }
                    },
                    "discount_application_index": 0
                }
            ]
        }
    ]
}
 

 

Reply 1 (1)

Small_Task_Help
Shopify Partner
1035 42 97

Hi,

Hope this will help

- Go to Order API Response
- Look for line_items
- Inside line_items, check for discount_allocations

Code example

"line_items": [
  {
    "title": "Toy Car",
    "price": "20.00",
    "discount_allocations": [
      {
        "amount": "5.00",
        "discount_application_index": 0
      }
    ]
  }
]

Please note - Shopify doesn’t always show discounts directly on products.

To Get Shopify Experts Help, Click Here or E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Expert India
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad