Skip to main content

useDiscount

This hook is used to get the discount data.

propsTypeDescriptionExample
cartSubTotalAmountNumberSubtotal amount of cart30
couponTitleStringCoupon title
couponTitleDisplayStringCoupon title display
couponMessageStringCoupon message
appliedDiscountCodeItemObjectApplied discount code item
openCouponListFunctionOpen coupon list<button onClick={openCouponList}>Open Coupon List</button>
couponsListArrayCoupons list
couponsListLoadingBooleanCoupons list loadingfalse
onApplyCouponFunctionOn apply coupononApplyCoupon(couponCode);
onRemoveCouponFunctionOn remove coupononRemoveCoupon(couponCode);
hasCouponAppliedBooleanHas coupon appliedtrue
isCouponApplyingLoadingBooleanIs coupon applying loadingfalse
isCouponRemovingLoadingBooleanIs coupon removing loadingfalse
canShowSuccessMessageBooleanCan show success messagetrue
dissmissSuccessMessageFunctionDissmiss success messagedissmissSuccessMessage();
setSuccessMessageFunctionSet success messagesetSuccessMessage('Success');
cartTotalQuantityNumberTotal quantity of items in cart2
appliedAutomaticDiscountItemObjectautomatic coupon object
hasAutomaticDiscountAppliedBooleanhas automatic coupon appliedtrue