PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.21
ووسلام – همگام سازی ووکامرس و باسلام v1.10.21
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 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 1.8.5 All 54 releases
← All changes | includes/Admin/Product/Services/ProductDisconnectService.php +3 -26 1.8.81.10.21 View file →
@@ -1,9 +1,9 @@
1 1 <?php
2 2
3 3 namespace SyncBasalam\Admin\Product\Services;
4 4
5 -use SyncBasalam\Utilities\ProductMetaKey;
5 +use SyncBasalam\Services\Products\ProductConnection;
6 6
7 7 defined('ABSPATH') || exit;
8 8
9 9 class ProductDisconnectService
@@ -10,36 +10,13 @@
10 10 {
11 11 public function disconnectSelected(array $productIds): void
12 12 {
13 13 foreach ($productIds as $productId) {
14 - $this->disconnectSingle($productId);
14 + $this->disconnectSingle((int) $productId);
15 15 }
16 16 }
17 17
18 18 private function disconnectSingle(int $productId): void
19 19 {
20 - $metaKeysToRemove = [
21 - ProductMetaKey::basalamProductId(),
22 - ProductMetaKey::basalamProductSyncStatus(),
23 - ProductMetaKey::basalamProductStatus(),
24 - ];
25 -
26 - foreach ($metaKeysToRemove as $metaKey) {
27 - delete_post_meta($productId, $metaKey);
28 - }
29 -
30 - $this->disconnectVariations($productId);
31 - }
32 -
33 - private function disconnectVariations(int $productId): void
34 - {
35 - $product = wc_get_product($productId);
36 -
37 - if ($product && $product->is_type('variable')) {
38 - $variationIds = $product->get_children();
39 -
40 - foreach ($variationIds as $variationId) {
41 - delete_post_meta($variationId, 'sync_basalam_variation_id');
42 - }
43 - }
20 + ProductConnection::purge($productId);
44 21 }
45 22 }