Skip to content

Commit 9ef7c79

Browse files
committed
version 3.6.2
1 parent 6602738 commit 9ef7c79

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/readme.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ The WordPress codex contains instructions on
115115

116116
== 3.6.2 ==
117117
- add NL translations
118+
- fix activation on multisite
119+
- make beans log available in woocommerce logs
120+
- fix earn points on product page
121+
- fix exclusion of collection on earn points
118122

119123
== 3.6.1 ==
120124
- activate support High-Performance Order Storage

src/storefront/liana/Views/LianaBlocks.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static function init($display)
1919
}
2020

2121
if (get_option(Helper::OPTIONS['product-points']['handle'])) {
22-
add_action('woocommerce_simple_add_to_cart', array(__CLASS__, 'renderProductInfo'), 10, 0);
22+
add_action('woocommerce_before_add_to_cart_form', array(__CLASS__, 'renderProductInfo'), 10, 0);
2323
}
2424

2525
if (get_option(Helper::OPTIONS['cart-notices']['handle'])) {
@@ -120,8 +120,30 @@ public static function renderCartNotice()
120120
$notice_earn_points = null;
121121
$notice_redeem_points = null;
122122
$notice_cancel_redemption = null;
123+
$redemption_params = self::$display['redemption'];
123124

124125
$cart_subtotal = Helper::getCart()->cart_contents_total;
126+
127+
# Customers do not get points when they purchase product in the excluded collections.
128+
# So they need to be removed from the points estimate.
129+
if (!empty($redemption_params["excluded_collection_cms_ids"])) {
130+
$amount_to_exclude = 0;
131+
$cart_items = Helper::getCart()->get_cart();
132+
foreach ($cart_items as $cart_item_key => $values) {
133+
$product = $values['data'];
134+
if (
135+
is_a($product, "WC_Product") &&
136+
array_intersect(
137+
$product->get_category_ids('edit'),
138+
$redemption_params["excluded_collection_cms_ids"]
139+
)
140+
) {
141+
$amount_to_exclude += $values['line_subtotal'];
142+
}
143+
}
144+
$cart_subtotal = $cart_subtotal - $amount_to_exclude;
145+
}
146+
125147
$cart_points = intval($cart_subtotal * self::$display['beans_ccy_spent']);
126148

127149
$account = BeansAccount::getSession();

0 commit comments

Comments
 (0)