POS App Bridge - applyCartDiscount stopped working 4/18/24

Topic summary

A breaking change in Shopify’s POS App Bridge library caused the applyCartDiscount function to stop working on April 18, 2024.

The Problem:

  • The function previously accepted discount parameters as an object but suddenly began hanging without completing its promise
  • Existing code that had worked for an extended period failed without warning

Root Cause:

  • Shopify changed the API signature without documentation or changelog entries
  • The function now requires parameters passed separately: applyCartDiscount('FixedAmount', 'Title', 5.00) instead of as an object: applyCartDiscount({type: 'FixedAmount', title: 'Title', amount: 5.00})

Current Status:

  • The official Shopify documentation and examples still show the old object-based syntax, creating confusion
  • Developers must use the undocumented parameter-based approach to restore functionality

This represents an undocumented breaking change that contradicts published API documentation.

Summarized with AI on November 9. AI used: claude-sonnet-4-5-20250929.

Hi everyone,

We were able to apply cart discounts to the POS cart through our app up through yesterday. Now, that same function (which is unchanged on our end) just hangs and never completes the promise.

Does anyone else see this?

Here is a snippet of the code (sorry for the loss of indentation):

// Set cart discount function
setCartDiscount = async function (discount, cb=null) {
const r = await shopify.pos.cart.applyCartDiscount(discount);
if (typeof(cb) === ‘function’) {
cb(r);
} else {
return r;
}
};

// After logic determining if they are eligible, this code is called

Promise.all(
[
setCartDiscount({
title : ‘Free Drink Claimed’,
type : ‘FixedAmount’,
amount : 4.50
}),

otherFunctionsOmitted({

// Omitted

})
]
)
.then(() => {

// Omitted

});

In case anyone else runs into this issue, I discovered the underlying problem. Basically, the AppBridge JS library changed (without entry in either the change log nor docs) from taking an object:

await applyCartDiscount({

type : ‘FixedAmount’,

title : ‘Whatever you want it to be’,

amount : 5.00

});

to having to pass the parameters in separately:

await applyCartDiscount(‘FixedAmount’, ‘Whatever you want it to be’, 5.00);

Of course, this is not what the documentation says (https://shopify.dev/docs/api/app-bridge-library/apis/pos#cart-propertydetail-applycartdiscount) , nor what their examples show (https://shopify.dev/docs/api/app-bridge-library/apis/pos#example-cart)).

To reiterate, the object-based code worked for a long time. Then, on 4/18/24, it suddenly stopped working. Obviously Shopify made a change and didn’t put it in the change log, nor update their docs. Not that I am in any way surprised.