Skip to content
Advertisement

Schedule WooCommerce sale price based on days of the week

Running a restaurant delivery website, I would like to create sale products based on “days of the week”.

Tuesday 5 products Wednesday 10 products Saturday 6 products

For example, if Tuesday and product id is on sale, then sales price should be shown. I tried re-using this but can’t find a topic about adding the sales price.

JavaScript

Advertisement

Answer

I havent been able to test this, but as an alternative to editing the price, which will hide the On Sale messages, as the product wouldnt really be a sale item according to WooCommerce.

This method, uses the existing sales functionality of WooCommerce by utilising the sale schedule from and to. Each day a cronjob runs and determines the current day, and either sets the sale from / to really far in the future, or to today. Allow you to keep storing the sales price in the normal field without the product being stuck on sale all the time, and WooCommerce visually will show to the customer the sale discount.

You will have to make sure you set a sale from / to, when updating products to stop the product going on sale straight away.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement