Skip to main content

setCustomDiscountStrategy

The setCustomDiscountStrategy method allows you to specify a custom discount strategy, replacing the default endpoint Growave uses (discount/<code>), which is unavailable on Custom Storefronts. By using setCustomDiscountStrategy, you can define custom methods for applying discount codes within your storefront setup.

Types​

DiscountServiceStrategyInterface​

Your custom strategy must implement this interface:

DiscountServiceStrategyInterface
interface

Interface for custom discount service strategy implementations. Allows you to define how discount codes are applied in your store.

Methods
applyDiscount(params)Promise<unknown>
Applies a discount code to the cart.
Parameters
NameTypeDescription
params{ discountCode: string }Parameters for applying discount
Returns:
Promise<unknown>
Promise that resolves when discount is applied