Delete stores
Edit on GitHubThis document describes how to delete stores.
- When taking the following steps, consider
xxxandXXXas the name of the store you are deleting. - We recommend taking these steps in a test environment. Make sure to create a backup of the database and other storages.
When to delete a store
Occasionally, a store created earlier becomes unnecessary. It may be a store that was used for a brand, product, holiday, marketing promotions, or events.
On the technical side, removing a store helps with the following:
- By deleting redundant data, which can take a lot of space, the shop’s speed is increased. The load on it for the purposes of indexing and searching is also reduced.
- Reducing wasted memory and your storage footprint.
Prerequisites
Back up the database
Back up the store’s database and make sure it’s recoverable. For instructions, see Create and restore database backups.
Suspend Publish and Sync
- Enable the maintenance mode:
vendor/bin/console maintenance:enable
For more information about maintenance mode, see Enable and disable maintenance mode.
-
Check the number of messaged in RabbitMQ. If there are too many, wait for them to be processed.
-
Suspend Publish and Sync and the cronjob scheduler:
vendor/bin/console scheduler:suspend
Clean data and configuration in related database tables
- Because of the foreign key relationship with the store entity, delete the data from the following tables:
spy_price_product_storespy_asset_storespy_availability_abstractspy_availabilityspy_availability_notification_subscriptionspy_category_storespy_cms_page_storespy_company_storespy_discountspy_discount_storespy_merchant_storespy_merchant_relationship_sales_order_thresholdspy_oms_product_reservationspy_oms_product_offer_reservationspy_payment_method_storespy_price_product_schedulespy_product_abstract_storespy_product_label_storespy_product_measurement_sales_unit_storespy_product_offer_storespy_product_option_value_pricespy_product_relation_storespy_quotespy_sales_order_thresholdspy_shipment_method_pricespy_shipment_method_storespy_stock_storespy_touch_searchspy_touch_storage
- The store has new configuration tables that are used for the dynamic store configuration. Delete the configuration data from the following tables by the store’s ID:
spy_locale_storespy_currency_storespy_country_store
- Delete the store’s data in any other tables related to the project’s features and custom functionality.
- Remove the row with the store’s data from the
spy_storetable.
Clean the data in the key-value storage engine
With the key-value store (Redis or Valkey), data is stored as keys that contain the store name. The key name follows this format: kv:{resource-type}:{store}:{locale}:{key}.
- Delete the following data in key-value store (Redis or Valkey):
- Stock information:
kv:availability:xxx:*
- Product details:
kv:price_product_abstract:xxx:*kv:price_product_abstract_merchant_relationship:xxx:*kv:price_product_concrete:xxx:*kv:price_product_concrete_merchant_relationship:xxx:*kv:product_abstract:xxx:*kv:product_abstract_category:xxx:*kv:product_abstract_option:xxx:*kv:product_abstract_relation:xxx:*kv:product_concrete_measurement_unit:xxx:*kv:product_concrete_product_offer_price:xxx:*kv:product_concrete_product_offers:xxx:*kv:product_label_dictionary:xxx:*kv:product_offer:xxx:*kv:product_offer_availability:xxx:*
- Product category details:
kv:category_node:xxx:*kv:category_tree:at:*
- CMS pages and blocks:
kv:cms_block:xxx:*kv:cms_page:xxx:*
- Merchant:
kv:merchant:xxx:*kv:price_product_abstract_merchant_relationship:xxx:*
- Adjust
kv:store_listby removing the store’s name from it’s value.
For example, you have AT, DE, and XXX stores.
{"stores":["AT","DE","XXX"],"_timestamp":111111111111}
To remove the XXX store, update kv:store_list as follows:
{"stores":["AT","DE"],"_timestamp":111111111111}
- Delete the
kv:store:xxxkey with the store data.
For example, you have kv:store:xxx in storage with some data. You need to delete it by the key.
{"id_store":3,"name":"XXX","default_locale_iso_code":"en_US","default_currency_iso_code":"EUR","available_currency_iso_codes":["EUR"],"available_locale_iso_codes":["de_DE","en_US"],"stores_with_shared_persistence":[],"countries":["DE"],"country_names":["Germany"],"_timestamp":11111111111}
- Delete any other store’s keys related to the project’s features and custom functionality.
Remove data from the search engine
With Elasticsearch, each configured store has its index, which is installed automatically. An indexed name consists of the following parts:
- An optional prefix, which is defined by the
SearchElasticsearchConstants::INDEX_PREFIXconfiguration option. For example, we usesprykerby default. - A store name.
- A configuration file name.
Index name components are delimited with an underscore—for example, spryker_xxx_page.
- Delete the following standard indexes in the search engine:
spryker_xxx_merchant.spryker_xxx_page.spryker_xxx_product-review.spryker_xxx_return_reason.
- Delete the any other store’s indexes related to the project’s features and custom functionality.
Resume P&S
- Restart the Cronjob scheduler:
vendor/bin/console scheduler:resume
- Disable the maintenance mode:
vendor/bin/console maintenance:disable
Verify that the store is deleted
- In the Back Office, go to Administration > Stores. Make sure the deleted store is not in the list.
- Make sure that the store is not available on the Storefront.
Thank you!
For submitting the form