use Discount Codeshook
hook
Returns the current discount codes applied to the cart, and automatically re-renders your component if discount codes are added or removed.
Anchor to useDiscountCodesuse Discount Codes()
use Discount Codes()
[]
UseDiscountCodesGeneratedType
Returns the current discount codes applied to the cart, and automatically re-renders your component if discount codes are added or removed.
CartDiscountCode[]
export function useDiscountCodes<
Target extends RenderExtensionTarget = RenderExtensionTarget,
>(): CartDiscountCode[] {
const {discountCodes} = useApi<Target>();
return useSubscription(discountCodes);
}
CartDiscountCode
- code
The code for the discount
string
export interface CartDiscountCode {
/**
* The code for the discount
*/
code: string;
}
Was this section helpful?