Set Specific Products on Sale by Time and Date


This code enables you, the storeowner, the ability to automatically schedule one or more specific products in WooCommerce for sale by :

  • Time
  • Day of week
  • Weekend
  • Weekdays

The sale price is updated for both :

  • Simple products
  • Variations products

In this example we set the product with id 111537 on sale on Monday between the times of 7am 07 00 and midnight 24 00 at a discount of 25%.

Code Installation

  1. Copy and paste the PHP code to the end of your child themes functions file or code snippets plugin.


  • Set your discount percentage rate on line 5.
  • Set the start time on line 14.
  • Set the end time on line 15.
  • Set the product id(s) on line 29, comma separated.
  • Set the day of week, weekdays, weekend on line 39.


Be the first to review “Set Specific Products on Sale by Time and Date”

Your email address will not be published. Required fields are marked *