Storefront Cart API - Add custom calculated discount to cart/line item(s)

Storefront Cart API - Add custom calculated discount to cart/line item(s)

gtsouvaltzis
Shopify Partner
3 0 0

According to Deprecation of Checkout APIs we're required to migrate all of our Checkout REST APIs to Storefront Cart API

Migrating to above-mentioned Storefront Cart API got us stuck with one of the problems that we're trying to overcome.

Problem is that whenever we programatically create Checkout using the REST API for the customer we were calculating discount on our end and supplied applied_discount property during the checkout creation.

to give you an understanding payload looks something like this:

 

 

/*
.... other properties are supplied for the Checkout creation
*/
"applied_discount": {
 "title": "Custom Calculated Discount",
 "value": "30.00",
 "description": "Custom Calculated Discount",
 "value_type": "fixed_amount",
 "amount": "30.00"
}

 

 

 above-mentioned value & amount properties are hardcoded for the time being, but those values are subject to change(according to our custom logic)

At the moment I couldn't find any useful mutation that would help me achieve similar result and apply either cart level or line item level discount

Replies 2 (2)

gtsouvaltzis
Shopify Partner
3 0 0

Anyone that could help with this by any chance?

gtsouvaltzis
Shopify Partner
3 0 0

Anyone that could help?