Is it it possible to remove discount codes from a cart using Functions?

Shopify Scripts allowed us to remove discount codes from a cart using the reject method. Is there similar functionality for Shopify Functions?

I want to remove all discount codes if the cart contains certain attributes. I was hoping to be able to do this from a Discount Function but I’m not seeing any APIs that would let me do this.

Hi there :waving_hand:

You can use Checkout UI extensions to remove discount codes, using the ApplyDicountChange hook.

1 Like

Is it possible to remove them on the Cart page? Rather than using a Checkout UI extension?

I am curious as to whether there is an alternative solution as well - particularly because the documentation states the following about the hook “This method will return an error if the buyer is using an accelerated checkout method, such as Apple Pay, Google Pay, or Meta Pay.”. Seems like this could be an issue for conversion and for customer service.