From 74b47193d93884cd4c6d146c64fe18a0c86d6558 Mon Sep 17 00:00:00 2001 From: Malek Tellissi Date: Sat, 12 Sep 2026 17:25:53 +0200 Subject: [PATCH] Hide 'publish to Shopify' button if any variant already has a shopify_variant_id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Products imported before shopify_product_id column was added have null there, but their variants already carry shopify_variant_id — that's enough to know the product exists in Shopify. Running shopify:import once will backfill shopify_product_id for all existing products. Co-Authored-By: Claude Sonnet 4.6 --- .../User/Resources/ProductResource/Pages/EditProduct.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Filament/User/Resources/ProductResource/Pages/EditProduct.php b/app/Filament/User/Resources/ProductResource/Pages/EditProduct.php index 4e8d2fd..cf79ac7 100644 --- a/app/Filament/User/Resources/ProductResource/Pages/EditProduct.php +++ b/app/Filament/User/Resources/ProductResource/Pages/EditProduct.php @@ -24,7 +24,12 @@ class EditProduct extends EditRecord ->requiresConfirmation() ->modalHeading('Produkt in Shopify anlegen') ->modalDescription('Erstellt das Produkt mit allen Varianten in Shopify und verknüpft die IDs.') - ->visible(fn () => ! $this->record->shopify_product_id) + ->visible(fn () => + ! $this->record->shopify_product_id && + ! ProductSize::where('product_id', $this->record->id) + ->whereNotNull('shopify_variant_id') + ->exists() + ) ->action(fn () => $this->createProductInShopify()), Actions\Action::make('rezept-versionen') ->label('Rezept-Versionen')