1. Home
  2. Docs
  3. WPC Product Timer
  4. [Important!] The Logic of Setting Timers

[Important!] The Logic of Setting Timers

Revision of 3 kinds of actions:

Now, we need to first look back on the 6 pairs of actions:

  • In Stock – Out of Stock
  • Visible – Hidden
  • Purchasable – Unpurchasable
  • Regular Price – Sale Price
  • Unfeatured – Featured
  • Enable – Disable Sold Individually

To begin with, we should bear in mind that these pairs are opposite actions by nature. WooCommerce has made all products to be in stock, purchasable, and visible by default. Hence, all the first half of the first 3 pairs we will call “default actions”. These actions cannot be used separately on normal on sale products.

The second half of those 3 pairs are called “reverse actions”. Their use is to achieve the opposite actions of default ones. We can use these actions to reverse the default state of a product set by WooCommerce.

The last 3 pairs are independent actions, which can be used separately and simultaneously on the same product. You don’t need to “Set unfeatured” first then “Set featured” to make it work and vice versa. The same rule applies to “Set sale price” & “Set regular price”, “Enable Sold Individually” & “Disable Sold Individually”. Though each pair is opposite by nature, they’re independent of each other.

So, we have 3 default actions as below:

  • Set in stock
  • Set purchasable
  • Set visible

Next, 3 reverse actions:

  • Set out of stock
  • Set unpurchasable
  • Set hidden

Last, 6 independent actions:

  • Set featured
  • Set unfeatured
  • Set sale price
  • Set regular price
  • Enable Sold Individually
  • Disable Sold Individually

Rules to set up timers:

Rule 1: Default actions cannot take effect by themselves without another reverse universal action (with Everyday time conditional) on top.

Rule 2: Reverse actions can work on their own.

Rule 3: 2 ways to set up actions for a daily time range conditional.

Rule 4: Independent actions work both individually or in pairs.

Next, we’ll discuss some rules to help users properly set up timers based on their needs:

Rule 1: Default actions cannot take effect by themselves on normal on sale products.

By default, when a product is put for sale, it must have a price (at least a regular price), in stock, visible, and purchasable so that customers can search for it, read about it, adding it to the cart and placing an order. If you use default actions on it, there is nothing going to happen. Why? Let’s examine some examples.

Example 1: A product is already in stock; if you set an action like “Set in stock, daily after time 5:00 PM”, nothing changes because the product is already in stock. But when you change the Stock status in the Inventory tab to Out of Stock or reduce the stock quantity of that item to 0 then use the above action, it works.

Note: When setting up timers, users should always bear in mind the current state of their product in order to choose the right action. That’s the reason why in most cases when users set the default actions only and it doesn’t work.

For a normal product that you are selling on your store: when you’d like to set a product to purchasable/ in stock/ visible on a specific date and time, you must first add an action to reverse its default state (to unpurchasable/ out of stock/ hidden) and put this action on top of the action line to make it work, then add the default action for a certain date and time under that.

Note: The order of actions counts as our plugin will check the conditionals and execute actions from the top down the list. Remember to put the reverse actions above default actions in these cases.

Example 2: In order to set a product to be visible on Sundays only, timers settings should be:

  • Action 1: Set hidden, Everyday.
  • Action 2: Set visible, Weekly on every Sunday.

Just use action 1 alone won’t make it work. Switching the order of 2 actions also affects the result.

Rule 2: Reverse actions can work by themselves.

Reverse actions always change the default state of your products, so they can work alone without the company of default actions.

Note: When setting up timers, it’s better to consider the opposite conditions to set reverse actions first.

Let’s consider the example 3:

Example 3: Make a product purchasable from Mondays to Fridays only.

According to rule 1: you might need to set it up like this if “Set purchasable” is to be used.

  • Action 1: Set unpurchasable, Everyday.
  • Action 2: Set purchasable, Weekly on every Monday
  • Action 3: Set purchasable, Weekly on every Tuesday
  • Action 4: Set purchasable, Weekly on every Wednesday
  • Action 5: Set purchasable, Weekly on every Thursday
  • Action 6: Set purchasable, Weekly on every Friday

While in fact, there’s a much shorter way: make your product unpurchasable on Saturdays and Sundays. So the settings should be:

  • Action 1: Set unpurchasable, Weekly on every Saturday
  • Action 2: Set unpurchasable, Weekly on every Sunday

Because reverse actions can work alone, so very often, you can pretty much time by simply using reverse actions to set the opposite conditions to your needs. Always remember to check this method first when it comes to setting up timers.

Rule 3: Set up timers for a (daily) time range

The time conditionals “daily time range” is a very special and frequently used one. In this part, we’ll discuss it in detail.

Example 4: Make a product purchasable only from 8:00 AM to 5:00 PM every day. We can use one of the following methods:

Method 1: 

  • Action 1: Set unpurchasable, Everyday
  • Action 2: Set purchasable, Daily time range: 8:00 AM – 5:00 PM.

Very often, users just use the daily time range conditional without action 1 on top and this is an incorrect approach. As stated in rule 1: default action cannot work individually. Users should use the opposite action to make sure that the product will go unpurchasable outside of the chosen time range.

Note: The chosen time range must be continued within the 24-hour duration of a day’s time. If the time range continues up to the next day, it might break the functionalities of the WPC Product Timer.

  • 6:00 AM – 6:00 PM is a continued time range.
  • 7:00 PM – 5:00 AM is not a continued time range.

Method 2: 

  • Action 1: Set unpurchasable, Daily before time 8:00 AM.
  • Action 2: Set unpurchasable, Daily after time 5:00 PM.

It’s simple, being purchasable between 8:00 AM and 5:00 PM means it is unpurchasable before 8:00 AM and after 5:00 PM. Users can set timers by breaking the time range into 2 temporal points: before and after.

In both methods, we can see that using reverse actions proves more effective than using the default actions. It’s recommended to always put a universal reverse action with the time conditional: Everyday (Set hidden – Everyday, Set unpurchasable – Everyday, Set Out of stock, Everyday)  at the top of the action line when you need to set up complicated timers. This method has a broader application scope, as in example 5, because it makes sure the status of your product will be reversed into the default state outside the chosen date and time.

Example 5: Your store sells a product only on Mondays and Thursdays and from 7:00 AM to 5: 00 PM & 7:00 PM to 10:00 PM.

Note: When considering actions, always consider the date part first, then add the time part.

The proper settings for the above example should be:

  • Action 1: Set unpurchasable, Everyday.
  • Action 2: Set purchasable, Weekly on every Monday
  • Action 3: Set purchasable, Weekly on every Thursday
  • Action 4: Set purchasable, Daily time range: 7:00 AM – 5:00 PM.
  • Action 5: Set purchasable, Daily time range: 7:00 PM – 10:00 PM.

 

Example 6: A product on your store is not available for sale before 6:30 AM and after 7:30 PM on weekdays. On weekends, it’s only available from 11:00 AM to 5:00 PM.

  • Action 1: Set unpurchasable, Everyday.
  • Action 2: Set purchasable, Daily time range: 6:30 AM – 7:30 PM.
  • Action 3: Set purchasable, Weekly on every Saturday – Daily time range: 11:00 AM – 5:00 PM.
  • Action 4: Set purchasable, Weekly on every Sunday – Daily time range: 11:00 AM – 5:00 PM.