if (! $existsInLa) { $laResponse = LaProductService::createProduct($this->shop, $shopifyProduct, $shopifyVariant); if (! $laResponse->successful()) { $logMessages[] = "{$shopifyVariant['barcode']} - VARIANT NOT EXPORTED TO LOGIACTION - ".$laResponse; } $laData = $laResponse->body(); if ($laData && isset($laData['id'])) { $product = Product::updateOrCreate( ['shopify_product_id' => $shopifyProduct['id']], [ 'la_id' => $laData['id'], 'la_external_id' => $laData['external_id'], 'la_item_number' => $laData['item_number'], 'last_synced' => now(), 'user_id' => $this->shop->id, ] ); $itemEan = $laData['itemEans'][0]; $variant = Variant::updateOrCreate( ['ean' => $shopifyVariant['barcode']], [ 'la_item_ean_id' => $itemEan['id'], 'la_item_id' => $itemEan['item_id'], 'shopify_variant_id' => $shopifyVariant['id'], 'shopify_inventory_item_id' => $shopifyVariant['inventory_item_id'], 'last_synced' => now(), 'product_id' => $product->id, // This is implicit through the relationship but included for clarity ] ); $logMessages[] = "{$shopifyVariant['barcode']} - VARIANT OK CREATED/UPDATED IN DATABASE"; $productsCreated++; } } Discord: sersjuh Skype: live:huijsenserge_1