@anker-in/shopify-react 0.1.1-beta.3 → 0.1.1-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -472,7 +472,7 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
472
472
  return { qualifyingGift: null, nextTierGoal: null };
473
473
  }
474
474
  const giftTiers = activeCampaign.rule_result.spend_get_reward.gift_product;
475
- const qualifyingTier = [...giftTiers].reverse().find((tier) => subtotal >= Number(tier.spend_sum_money));
475
+ const qualifyingTier = [...giftTiers].sort((a, b) => Number(b.spend_sum_money) - Number(a.spend_sum_money)).find((tier) => subtotal >= Number(tier.spend_sum_money));
476
476
  const nextGoal = giftTiers.find((tier) => subtotal < Number(tier.spend_sum_money));
477
477
  if (!qualifyingTier) {
478
478
  return { qualifyingGift: null, nextTierGoal: nextGoal || null };