PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.28
ووسلام – همگام سازی ووکامرس و باسلام v1.10.28
1.10.28 1.1.26 1.10.27 1.10.24 1.10.25 1.10.23 1.10.22 1.10.21 1.10.19 1.10.20 1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 All 61 releases
← All changes | includes/Services/Products/Discount/VariableProductDiscount.php +4 -5 1.10.9 → 1.10.28 View file →
@@ -17,10 +17,10 @@
17 17 {
18 18 foreach ($product->get_children() as $variation_id) {
19 19 $variation = wc_get_product($variation_id);
20 20 if (!$variation) continue;
21 - $basalam_id = get_post_meta($variation_id, 'sync_basalam_variation_id', true);
22 - if (!$basalam_id) continue;
21 + $basalam_ids = array_filter((array) get_post_meta($variation_id, 'sync_basalam_variation_id', false));
22 + if (!$basalam_ids) continue;
23 23
24 24 $regular = $variation->get_regular_price();
25 25 $sale = $variation->get_sale_price();
26 26
@@ -26,9 +26,9 @@
26 26
27 27 if (!$regular || !$sale) continue;
28 28
29 29 $discount = $this->discountService->calculateDiscountPercent($regular, $sale);
30 - $this->discountService->apply($discount, null, [$basalam_id], null);
30 + $this->discountService->apply($discount, null, $basalam_ids, null);
31 31 }
32 32 }
33 33
34 34 public function remove($product): void
@@ -34,10 +34,9 @@
34 34 public function remove($product): void
35 35 {
36 36 $basalam_ids = [];
37 37 foreach ($product->get_children() as $variation_id) {
38 - $basalam_id = get_post_meta($variation_id, 'sync_basalam_variation_id', true);
39 - if ($basalam_id) $basalam_ids[] = $basalam_id;
38 + $basalam_ids = array_merge($basalam_ids, array_filter((array) get_post_meta($variation_id, 'sync_basalam_variation_id', false)));
40 39 }
41 40 if (!empty($basalam_ids)) $this->discountService->remove(null, $basalam_ids);
42 41 }
43 42 }