useDiscount
This hook is used to get the discount data.
props | Type | Description | Example |
---|---|---|---|
cartSubTotalAmount | Number | Subtotal amount of cart | 30 |
couponTitle | String | Coupon title | |
couponTitleDisplay | String | Coupon title display | |
couponMessage | String | Coupon message | |
appliedDiscountCodeItem | Object | Applied discount code item | |
openCouponList | Function | Open coupon list | <button onClick={openCouponList}>Open Coupon List</button> |
couponsList | Array | Coupons list | |
couponsListLoading | Boolean | Coupons list loading | false |
onApplyCoupon | Function | On apply coupon | onApplyCoupon(couponCode); |
onRemoveCoupon | Function | On remove coupon | onRemoveCoupon(couponCode); |
hasCouponApplied | Boolean | Has coupon applied | true |
isCouponApplyingLoading | Boolean | Is coupon applying loading | false |
isCouponRemovingLoading | Boolean | Is coupon removing loading | false |
canShowSuccessMessage | Boolean | Can show success message | true |
dissmissSuccessMessage | Function | Dissmiss success message | dissmissSuccessMessage(); |
setSuccessMessage | Function | Set success message | setSuccessMessage('Success'); |
cartTotalQuantity | Number | Total quantity of items in cart | 2 |
appliedAutomaticDiscountItem | Object | automatic coupon object | |
hasAutomaticDiscountApplied | Boolean | has automatic coupon applied | true |