In the configuration, you can activate a setting that hides products from customers when they are out of stock. This function depends on a scheduled job that runs every 30 minutes.
For a product to be hidden automatically, the following conditions must be met:
- The product has passed its unpublished date.
- The product has an inventory (including reservations) of 0 or less.
Activate the setting in configuration
- Navigate to configuration -> products -> inventory
- Enable the setting “Disable expired and out-of-stock products automatically”
Set up the scheduled task
- Navigate to configuration -> advanced -> scheduled task
- Click on the three ellipsis and click "Add."
- Search for productinventory in the implementation type, and set the schedule to */30 * * * * to ensure the job runs every 30 minutes.
Setting the unpublished date
To set the unpublished date, follow these steps:
- Go to Products in the navigation menu.
- Select the desired product -> edit product -> settings
- Set an unpublished date for the product.
4. The product will now be automatically deactivated when the inventory reaches 0.
Note: If a product does not have an unpublished date, automatic deactivation will be ignored for that product.