Knowledge Base
How to setup or troubleshoot the Recurring Expiration
Recurring Pattern
The pattern determines the time frame to renew the coupon expiration. If you select monthly and choose the last day of the month. The coupon will renew on the day after the expiration to the last day of the next month. You can select any of the patterns and it will renew the expiration date plus the pattern using a function triggered from a WordPress Cron.
- Monthly
- Weekly
- Biweekly
- Every 3 Weeks
Recurring Limit
The limit sets how many times to renew the expiration. The range is from 0 to 20 or use the unlimited option.
If you select unlimited, the coupon will renew the expiration per the pattern as long as the coupon is published.
If you select a number it renew until it hits 0, then it will expire once the expiration date is reached.
WP Cron
The expiration pattern is run by a WordPress Cron every 30 minutes. The WordPress Cron relies on visitors to your site in order to be triggered. Because of this, it may not be triggered exactly when a coupon is expired and ready to be renewed. If you would like a more precise cron, you can setup a real cron follow the steps in this article from WPDailyBits – How to Replace WordPress Cron With A Real Cron Job.
Troubleshooting WP Cron
If you are not seeing your expiration dates recur, then the first place to check on your site is all the crons and make sure it is scheduled. There is a plugin called, WP Crontrol that once installed creates a page in your admin under Tools > Crontrol that will give you a list of all the scheduled crons.
There you want to look for this hook name: cctor_pro_process_recurring_expiration.
If you do not see it, you can deactivate and reactive Pro and that should reschedule it.
If that still does not work, you can manually add the cron using the following settings:
Hook Name:
cctor_pro_process_recurring_expiration
Arguments:
None
Next run (UTC):
Now
Event schedule:
Once Every 20 Mins (20 minutes)
For the event schedule you could select another value, but Pro sets it to be every 30 minutes.
Filter Cron Interval
The default for the recurring cron is every 30 minutes and you can use the following filter to change that interval.
In this example, it creates a 5 minute interval and then filters that to the coupon creator recurring cron. You can customize this to another interval if you like. Add it to a custom plugin or your child theme’s functions.php and then deactivate and reactive Pro. You can also manually add it using the WP Crontrol Plugin too.
/* * Custom Cron Interval * * @http://codex.wordpress.org/Function_Reference/wp_get_schedules */ add_filter( 'cron_schedules', 'cctor_cron_every_five_minutes' ); function cctor_cron_every_five_minutes( $schedules ) { // Adds once every 5 minutes to existing cron schedules $schedules['every_5mins'] = array( 'interval' => 300, 'display' => __( 'Every 5 Minutes' ) ); return $schedules; } /* * Coupon Creator Pro - Custom Recurring Expiration Cron Interval * @version 2.1 */ add_filter('cctor_pro_recurrence_processor_interval', 'cctor_pro_custom_expiration_cron_interval' ); function cctor_pro_custom_expiration_cron_interval( $interval ) { //Set cron to every 5 minutes $interval = 'every_5mins'; return $interval; }
Recurring Limit Filter
Return a number using this filter to change the range:
cctor_filter_recurring_limit_amount