# sync-basalam/1.9.2/includes/Admin/Product/Services/ProductDisconnectService.php

ووسلام – همگام سازی ووکامرس و باسلام, version 1.9.2. 46 lines.

- Page: https://pluginprobe.com/plugins/sync-basalam/1.9.2/code/includes/Admin/Product/Services/ProductDisconnectService.php
- Raw: https://pluginprobe.com/plugins/sync-basalam/1.9.2/raw/includes/Admin/Product/Services/ProductDisconnectService.php
- Modified: 2026-07-08T11:26:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/sync-basalam/1.9.2/code/includes/Admin/Product/Services/ProductDisconnectService.php#L10-L20`.

```php
<?php

namespace SyncBasalam\Admin\Product\Services;

use SyncBasalam\Utilities\ProductMetaKey;

defined('ABSPATH') || exit;

class ProductDisconnectService
{
    public function disconnectSelected(array $productIds): void
    {
        foreach ($productIds as $productId) {
            $this->disconnectSingle($productId);
        }
    }

    private function disconnectSingle(int $productId): void
    {
        $metaKeysToRemove = [
            ProductMetaKey::basalamProductId(),
            ProductMetaKey::basalamProductSyncStatus(),
            ProductMetaKey::basalamProductStatus(),
        ];

        foreach ($metaKeysToRemove as $metaKey) {
            delete_post_meta($productId, $metaKey);
        }

        $this->disconnectVariations($productId);
    }

    private function disconnectVariations(int $productId): void
    {
        $product = wc_get_product($productId);

        if ($product && $product->is_type('variable')) {
            $variationIds = $product->get_children();

            foreach ($variationIds as $variationId) {
                delete_post_meta($variationId, 'sync_basalam_variation_id');
            }
        }
    }
}

```
