Navigate to WooCommerce and click on “Settings” in the dropdown menu.
In the Settings page, go to the “Advanced” tab.
Scroll down to the “Order handling” section.
Here, you will find the “Delete Orders” option. By default, the value is set to 30 days, indicating that canceled orders will be deleted after 30 days in the trash.
If you want to change the deletion period, modify the value in the “Delete Orders” field to your desired number of days. For example, setting it to 60 will retain canceled orders in the trash for 60 days before permanent deletion.
If you prefer to disable the automatic deletion of canceled orders, uncheck the “Enable the scheduled order delete” option.
Remember to click the “Save changes” button at the bottom of the page to apply your modifications.