Apply a discount code; recomputes totals (422 if ineligible)
POST
/store/v1/carts/{cartId}/discounts
const url = 'https://your-store.example.com/store/v1/carts/example/discounts';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"code":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://your-store.example.com/store/v1/carts/example/discounts \ --header 'Content-Type: application/json' \ --data '{ "code": "example" }'Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ” cartId
required
string
Request Body required
Section titled “Request Body required ” Media type application/json
object
code
required
string
Example generated
{ "code": "example"}