This PHP code adds functions which enable you to add different cart fees based on the time and or day of the week in WooCommerce.
The code includes 5 examples which execute based on :
- By the hour. Example : 6pm which is 18 or 9am which is 9.
- Time. Example : between 9am and 6pm.
- Day & time. Example : on Thursday between 9am and 6pm.
- Weekend. Example : either Saturday or Sunday.
- Day. Example thursday.
The code also enables you to set different fee’s based on the above date and time. If the conditions are met, the first price is displayed otherwise another price is shown.
The following gallery images show different fee’s added to the cart totals based on time, day and day and time.
Installation & Setup
There’s 2 steps :
-
Copy & paste the code to the end of your child themes functions file or custom functions/code snippets plugin.
-
Set the product id on line 15 and the fee on line 37 using any of the day time variables. By default the fee is set to $day. Change this to any of the following : $hour, $time, $day_time, $weekend
Reviews
There are no reviews yet.