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.
sdk.discount.methods.setCustomDiscountStrategy()setCustomDiscountStrategy(strategy: DiscountServiceStrategyInterface): voidParameters
strategyDiscountServiceStrategyInterface
Types
DiscountServiceStrategyInterface
Your custom strategy must implement this interface:
DiscountServiceStrategyInterfaceInterface 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
| Name | Type | Description |
|---|---|---|
| params | { discountCode: string } | Parameters for applying discount |
Returns:
Promise<unknown>
Promise that resolves when discount is applied