Syncing Products Across Multiple Shopify Stores – Minor Issue with Options

I’ve built a script with Laravel that automatically syncs products across multiple Shopify stores.
Here’s how it works:

  • When I create a product in the main store (Store X), it’s automatically created in two other stores as well.
  • When I update the product in Store X, the changes sync across the others.

Everything has worked great so far… except for one small issue with product options (variants).

:pushpin: The problem: when I add or remove options (e.g., size, color), the changes don’t reflect properly in the other stores.
Here’s a simplified version of the code I’m using to update variants via GraphQL:

public function updateVariantInStore2(Client $client, $variantIdStore2, array $variantDataStore1)
{
    $mutation = <<<'GRAPHQL'
    mutation productVariantUpdate($input: ProductVariantInput!) {
        productVariantUpdate(input: $input) {
            productVariant {
                id
                sku
                price
                compareAtPrice
                barcode
                taxable
                title
                selectedOptions {  
                    name
                    value
                }
            }
            userErrors {
                field
                message
            }
        }
    }
    GRAPHQL;

    $input = [
        'id' => $variantIdStore2,
        'price' => $variantDataStore1['price'],
        'compareAtPrice' => $variantDataStore1['compare_at_price'],
        'barcode' => $variantDataStore1['barcode'],
        'inventoryPolicy' => strtoupper($variantDataStore1['inventory_policy']),
        'taxable' => $variantDataStore1['taxable'],
        'title' => $variantDataStore1['title'],
        'inventoryItem' => [
            'sku' => $variantDataStore1['sku']
        ],
        'options' => []  
    ];

    if (!empty($variantDataStore1['option1'])) {
        $input['options'][] = $variantDataStore1['option1'];
    }
    if (!empty($variantDataStore1['option2'])) {
        $input['options'][] = $variantDataStore1['option2'];
    }
    if (!empty($variantDataStore1['option3'])) {
        $input['options'][] = $variantDataStore1['option3'];
    }

    try {
        $response = $client->post('', [
            'json' => [
                'query' => $mutation,
                'variables' => ['input' => $input]
            ]
        ]);

        $body = json_decode($response->getBody(), true);

        if (isset($body['data']['productVariantUpdate'])) {
            return true;
        } else {
            Log::error('❌ Shopify Variant Update Errors:', $body['errors']);
            return false;
        }
    } catch (\Exception $e) {
        Log::error('Shopify Variant Update Exception: ' . $e->getMessage());
        return false;
    }
}


Even though the response from Shopify includes the correct selectedOptions, the updates don’t seem to fully apply when it comes to adding or removing options.

:speech_balloon: Has anyone faced a similar issue when syncing variants between Shopify stores via API?
Would love to hear how you handled syncing option changes correctly across multiple stores.

Hi @Josh_C

productVariantUpdate only updates a single variant’s fields (price, SKU, etc.), not the product’s options or the set of variants. To add or remove options, you’ll want to update the product itself and its variants, not just individual variants.

When options or option values change in Store X, use productSet in the other stores to overwrite the product’s options and variants to match Store X. For simple property updates (price, SKU, etc.), you can continue using productVariantUpdate.