@scayle/storefront-promotions
3.0.0
Major Changes
- Update
useApplyPromotions
composable to support applying multiple promotions on basket items.
The functionapplyPromotions
can now apply multiple promotions to basket items. No changes are required for your existing implementation.
Minor Changes
- Updated
useApplyPromotions
composable to support removing multiple promotions from a basket item.
The functionsremovePromotion
,removePromotionById
andremoveAllPromotionsFromBasket
now removes multiple promotions based in the newpromotions
attribute of the basket item. No changes are required for your existing implementation. - Updated
useAppliedPromotionCodes
composable to support multiple promotions on basket items.
If present,appliedCodes
now returns a record of promotion codes, including cases where the multiple promotion codes are applied to a basket item. No changes are required for your existing implementation. - Updated
useBasketPromotions
composable to support multiple promotions on basket items.
The computed propertyvalidPromotions
now returns a list of unique promotions including cases where multiple promotion are applied to a basket item, together with their total reduction amount. No changes are required for your existing implementation. - Deprecated
isFreeGiftBasketItem
in favor ofisBuyXGetYBasketItem
.
The newisBuyXGetYBasketItem
utility returnstrue
for basket items eligible for buy-x-get-y promotions and correctly handles cases where multiple promotions apply to the same item. No changes are required for your existing implementation.
2.3.0
Minor Changes
- The
useApplyPromotions
composable now includes aremoveAllPromotionsFromBasket
function, providing an easy way to clear all promotions from a basket in a single action. Under the hood, the existingremovePromotionById
function has also been refactored to use the more efficientbulkUpdatePromotions
Storefront API endpoint via theupdatePromotions
RPC method. For more details, see the Storefront API documentation.
2.2.3
Patch Changes
- To improve stability, the
applyPromotions
function of theuseApplyPromotions
composable has been updated to prevent infinite re-application loops when multiple promotions target the same basket item. It now only replaces an existing promotion if a newly applicable one has a higher priority, ensuring predictable behavior.
2.2.2
Patch Changes
- Added explicit return type for
usePromotionGifts
composable to resolveunknown
type issues with the return values.
The new return type of the composable is:
This change has no impact on existing implementations of the composable.
2.2.1
Patch Changes
- Resolved issue were promotion code could not be removed.
Removed the deprecatedpromotionCode
parameter from theupdateBasketItem
RPC call forremovePromotion
function inuseApplyPromotions
composable.
2.2.0
Minor Changes
- Added a new
usePromotionTierProgress
composable which can be used to get the progress and status of tiered promotions. In addition to returning the overall progress of the promotion, it also returns the progress state of the individual tiers of the promotion.
2.1.0
Minor Changes
- Added a new composable
useAppliedPromotionCodes
. This composable returns the promotion codes which have been applied to the current basket, including the promotion details and the item keys of the items to which each code applies. - Added
removePromotionById
touseApplyPromotions
which can be used to remove promotions from all basket items which have a promotion with the specified ID.
2.0.1
Patch Changes
applyPromotions
now acceptsMaybeRef<Basket>
instead ofRef<Basket>
allowing for more flexibility in usage.
2.0.0
Major Changes
- Updated
useApplyPromotions
to require a basket reference. This basket will be updated when calling functions such asapplyPromotions
andremovePromotion
. The basket passed toapplyPromotions
will still be used as the source of theapplicablePromotions
, but it is now optional and the current basket will be used as a fallback.
Before:
After:
Minor Changes
- Updated
useApplyPromotions
to include aremovePromotion
function. This can be used to remove an applied promotion from a basket item.
1.1.0
Minor Changes
- Updated
useApplyPromotions
to include the promotion code when applicable.
1.0.0
Major Changes
- Breaking: The following functions are no longer provided by
@scayle/storefront-promotions
:isFreeGiftEligible
,getVariantIds
andisGiftInBasket
. If necessary, these functions should be re-implemented within your application.
Below are examples of how these functions were previously implemented:
Minor Changes
- Simplified the logic of the
isFreeGiftBasketItem
function. It now checks the following criteria:- The promotion exists on the basket item
- The promotion is valid
- The promotion is a
isBuyXGetY
promotion
0.3.0
Minor Changes
- Removed the duplicate utility function
isPromotionGiftAddedToBasket
, as its functionality is already covered byisGiftInBasket
.
0.2.0
Minor Changes
- Update to
@nuxt/module-builder@1
. This version of Nuxt Module Builder is ESM-only, so CommonJS (.cjs
) files will no longer be built or distributed with the package. However as of Nuxt 3, only esm is used so this should not have any impact as this module does not support Nuxt 2.
0.1.1
Patch Changes
- Removed imports from indirect dependencies and rely on direct imports from
@scayle/storefront-nuxt
0.1.0
Minor Changes
- Initial release of
@scayle/storefront-promotions
. This package separates promotion functionality from the SCAYLE Storefront Application, facilitating easier integration and maintenance. It includes the following RPC's, composable and utility functions.- RPC's:
getPromotionGiftProducts
- Composables:
useApplyPromotions
useBasketPromotions
usePromotionMOVProgress
usePromotionGifts
- Utilities:
getBasketTotalWithoutPromotions
getTotalReductionsByCategory
sortPromotionsByPriority
isGiftConditionMet
isBuyXGetYType
isAutomaticDiscountType
getVariantIds
isFreeGiftEligible
isFreeGiftBasketItem
isGiftInBasket
isPromotionGiftAddedToBasket
- RPC's: