/** * @param StoreEntity $store * @param CatalogEntity $catalog */ public function deleteCollection(StoreEntity $store, CatalogEntity $catalog) { //Collection has already been deleted if (is_null($catalog->getShopifyCollectionId())) { return; } $this->setSettings($store); try { $this->client->deleteCustomCollection(['id' => $catalog->getShopifyCollectionId()]); $catalog->setShopifyCollectionId(null); } catch (CommandClientException $e) { //if 404, Collection has already been deleted via shopify, lets carry on if ($e->getResponse()->getStatusCode() != '404') { throw $e; } } }