When customers add products to their shopping carts and then leave the site without finishing their purchases, the shopping cart is saved in the database along with the products in the cart. This can cause bloating of your database and in the end, it can slow down the whole website.
To prevent bloating of the database:
- Set up after how many days shopping carts are considered as old.
- Set a regularly launched task that removes the shopping carts from the database.
Setting up after how many days shopping carts are considered as old
As with most of the e-commerce settings, you can set the time after the shopping carts are considered as old for the current site or globally for all your sites running on the Kentico instance. If you run more sites on your instance and all sites should use the same number of days, use global settings; otherwise, we recommend that you choose site settings.
- Open the Store configuration application (if you want to specify the setting for the current site) or the Multistore configuration application (if you want to specify the setting globally).
If you are not sure what to choose, see Choosing site or global e-commerce configuration. If you are not sure about specifics of configuring in these applications, see Configuring e-commerce settings for a specific site or globally.
- In the Shopping cart category of the Store configuration -> General tab, enter the following properties to the Clear content of old shopping cart after (days) field:
- Clear the Inherit from global settings option (only if you work in the Store configuration application).
- Type the desired number of days after which shopping carts should be considered as old and should be deleted to the text box, for example 30.
- Click Save.
The system updates the settings and scheduled tasks working with this setting (not any yet) operates with the specified number of days.
Configuring a scheduled task that deletes old shopping carts
- Open the Scheduled tasks application.
- In the Site selector, select the desired site (if you want to create the scheduled task for a specific site) or leave the (global) option (if you want to create the scheduled task globally).
- Click New task.
- Enter the following properties:
- Task display name: Clear content of old shopping carts
- Task provider:
- Assembly name: CMS.Ecommerce
- Class: CMS.Ecommerce.ShoppingCartCleaner
- Task enabled: Yes (selected)
- Enter the other properties according to your needs.
- Click Save.
The system now clears the database from the shopping carts of the unfinished purchases.
See the task on the sample Dancing Goat site as an example.
- Configuring steps of the checkout process
- Allowing checkout processes for anonymous or registered customers
- (Optional) Enabling automatic registration for anonymous customers
- (Optional) Displaying the shopping cart preview on pages
- (Optional) Removing old shopping carts from the database
- Choosing site or global e-commerce configuration
- Configuring currencies
- Configuring taxes
- Configuring multilingual stores
- Configuring product page types
- Configuring products
- Configuring product pages
- Checkout process
- Removing old shopping carts from the database
- Configuring shipping options
- Configuring payment methods
- Configuring invoices
- Configuring e-commerce email notifications
- Configuring user registration in stores
- Configuring permissions for store managers