Title: Brian Watson's Replies | WordPress.org

---

# Brian Watson

  [  ](https://wordpress.org/support/users/bswatson/)

 *   [Profile](https://wordpress.org/support/users/bswatson/)
 *   [Topics Started](https://wordpress.org/support/users/bswatson/topics/)
 *   [Replies Created](https://wordpress.org/support/users/bswatson/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/bswatson/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/bswatson/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/bswatson/engagements/)
 *   [Favorites](https://wordpress.org/support/users/bswatson/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 26 total)

1 [2](https://wordpress.org/support/users/bswatson/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/bswatson/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Is this Plugin still being maintained?](https://wordpress.org/support/topic/is-this-plugin-still-being-maintained-17/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/is-this-plugin-still-being-maintained-17/#post-15431329)
 * Hello!
 * We still do monitor and fix issues as we can, but have not had a chance to actively
   test against the latest versions of WordPress or WooCommerce. If you run in to
   an issue, please submit a support request and we’ll either provide a workaround
   or get a fix in place.
 * Thank you!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Reset Time (Weekly)](https://wordpress.org/support/topic/reset-time-weekly/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/reset-time-weekly/#post-15431321)
 * I have not had a chance to test this, so I apologize if it doesn’t work without
   some tweaking. Here’s an example plugin that you could try that would add a “
   Weekly at 5pm” option.
 * Hope this helps get you going in the right direction!
 *     ```
       <?php
       /**
        * Plugin Name: Limit Orders for WooCommerce - Weekly Intervals at 5pm
        * Description: Add a "Weekly at 5pm" option to Limit Orders for WooCommerce.
        * Author:      Nexcess
        * Author URI:  https://nexcess.net
        */
   
       /**
        * Add "Annually" to the list of intervals.
        *
        * @param array $intervals Available time intervals.
        *
        * @return array The filtered array of intervals.
        */
       add_filter( 'limit_orders_interval_select', function ( $intervals ) {
       	// Return early if it already exists.
       	if ( isset( $intervals['weekly_at_5pm'] ) ) {
       		return $intervals;
       	}
   
       	$intervals['weekly_at_5pm'] = sprintf(
               /* Translators: %1$s is the first day of the week, based on site configuration. */
               _x( 'Weekly (resets every %1$s) at 5pm', 'order threshold interval', 'limit-orders' ),
               $wp_locale->get_weekday( get_option( 'start_of_week' ) )
           );
   
       	return $intervals;
       } );
   
       /**
        * Get a DateTime object representing the beginning of the week at 5pm.
        *
        * @param \DateTime $start    The DateTime representing the start of the current interval.
        * @param string    $interval The type of interval being calculated.
        *
        * @return \DateTime A DateTime object representing the top of the current hour or $start, if the
        *                   current $interval is not "weekly_at_5pm".
        */
       add_filter( 'limit_orders_interval_start', function ( $start, $interval ) {
       	if ( 'weekly_at_5pm' !== $interval ) {
       		return $start;
       	}
   
           $start = current_datetime();
   
           $start_of_week = (int) get_option( 'week_starts_on' );
           $current_dow   = (int) $start->format( 'w' );
           $diff          = $current_dow - $start_of_week;
   
           // Compensate for values outside of 0-6.
           if ( 0 > $diff ) {
               $diff += 7;
           }
   
           // A difference of 0 means today is the start; anything else and we need to change $start.
           if ( 0 !== $diff ) {
               $start = $start->sub( new \DateInterval( 'P' . $diff . 'D' ) );
           }
   
           return $start->setTime( 17, 0, 0 );
       }, 10, 2 );
   
       /**
        * Filter the DateTime at which the next interval should begin.
        *
        * @param \DateTime $start    A DateTime representing the start time for the next interval.
        * @param \DateTime $current  A DateTime representing the beginning of the current interval.
        * @param string    $interval The specified interval.
        *
        * @return \DateTime The DateTime at which the next interval should begin, or $start if the
        *                   current $interval is not "weekly_at_5pm".
        */
       add_filter( 'limit_orders_next_interval', function ( $start, $current, $interval ) {
       	if ( 'weekly_at_5pm' !== $interval ) {
       		return $start;
       	}
   
       	return $current->add( new \DateInterval( 'P7D' ) );
       }, 10, 3 );
       ```
   
    -  This reply was modified 4 years, 4 months ago by [Brian Watson](https://wordpress.org/support/users/bswatson/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Stops working randomly](https://wordpress.org/support/topic/stops-working-randomly-3/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/stops-working-randomly-3/#post-13383845)
 * Hello!
 * Apologies for the delay, but we’ll check this out and see if we can replicate
   or get an idea what may be causing the issue.
 * One question I have to help point us in the right direction –
 * When you say it stops working, does that mean it continues to allow orders even
   after the limit has been reached, or does it stop allowing orders prior to the
   limit?
 * Thank you!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Order limit not working](https://wordpress.org/support/topic/order-limit-not-working/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/order-limit-not-working/#post-13297350)
 * Hello!
 * Each time a customer goes through the checkout process, it counts as one order.
   The plugin does not restrict the number of items in an order, just the total 
   amount of orders in a given time frame.
 * You can test if this is working by completing four additional orders. When you
   go to make a 5th, you should then see the add to cart button removed and a message
   in its place.
 * Thank you for checking out the plugin and let us know if you continue to see 
   issues.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Limit by dollar amount?](https://wordpress.org/support/topic/limit-by-dollar-amount/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [6 years ago](https://wordpress.org/support/topic/limit-by-dollar-amount/#post-13093198)
 * Hello and thank you for checking out the plugin!
 * The plugin does not currently have the ability to restrict orders based on the
   dollar amount. The complexity when dealing with multiple product prices would
   make it difficult to target a specific amount.
 * Number of items sold is not supported, but would be significantly easier to implement
   and we can evaluate if it would fit as part of this plugin.
 * Our primary developer on this plugin is out for the week, but I’ll follow up 
   next week after I have a chance to discuss with him.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Limit Orders Per Hour](https://wordpress.org/support/topic/limit-orders-per-hour/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/limit-orders-per-hour/#post-12738747)
 * [@studioforonda](https://wordpress.org/support/users/studioforonda/),
 * We’ll be releasing an update shortly that includes the ability to limit orders
   per hour.
 * I’m not sure if it’ll be out today, but we’ll definitely have it available by
   the end of the week.
 * Thanks for the suggestion!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] PHP Call to undefined function](https://wordpress.org/support/topic/php-call-to-undefined-function/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/php-call-to-undefined-function/#post-12721913)
 * [@dunsterd](https://wordpress.org/support/users/dunsterd/) –
 * At the moment, we’ve written it with support for the latest version of WooCommerce(
   4.0). WooCommerce has not supported PHP 5.6 since version 3.9, so we likely won’t
   be going back to implement compatibility with that version.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Orders have exceeded the limit](https://wordpress.org/support/topic/orders-have-exceeded-the-limit/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/orders-have-exceeded-the-limit/#post-12702831)
 * Great to hear!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Limit based on Delivery Date rather than Order Date](https://wordpress.org/support/topic/limit-based-on-delivery-date-rather-than-order-date/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/limit-based-on-delivery-date-rather-than-order-date/#post-12702553)
 * We would likely need to build a custom integration with that plugin to make it
   work.
 * Not saying that it can’t be done, but it would likely require more time than 
   we currently have to allocate to this plugin.
 * I see the WooCommerce Order Delivery plugin has a [request board](https://ideas.woocommerce.com/forums/133476-woocommerce?category_id=148485)
   and it does look like that feature is the most frequently requested item.
 * I’ve created a [ticket in the GitHub project](https://github.com/nexcess/limit-orders/issues/15)
   to track this, and will let you know if we work out a solution.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Limit Orders Did Not Work](https://wordpress.org/support/topic/limit-orders-did-not-work/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/limit-orders-did-not-work/page/2/#post-12702235)
 * Great to hear!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Limit Orders Did Not Work](https://wordpress.org/support/topic/limit-orders-did-not-work/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/limit-orders-did-not-work/page/2/#post-12702185)
 * Wanted to check in and see if things are working as expected now. Let us know
   if you continue to see any issues.
 * Thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Orders have exceeded the limit](https://wordpress.org/support/topic/orders-have-exceeded-the-limit/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/orders-have-exceeded-the-limit/#post-12702180)
 * Wanted to check in and see if things are working as expected now. Let us know
   if you continue to see any issues.
 * Thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Limit based on Delivery Date rather than Order Date](https://wordpress.org/support/topic/limit-based-on-delivery-date-rather-than-order-date/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/limit-based-on-delivery-date-rather-than-order-date/#post-12702112)
 * [@ehlanafoley](https://wordpress.org/support/users/ehlanafoley/),
 * How do you set the delivery date within WooCommerce? Is it a custom field or 
   are you using a plugin to handle that?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Limit Orders Did Not Work](https://wordpress.org/support/topic/limit-orders-did-not-work/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/limit-orders-did-not-work/page/2/#post-12690576)
 * Hey [@bizdata](https://wordpress.org/support/users/bizdata/) –
 * We were able to track down the cause of this and just released v1.1.2 to fix 
   it. Please download the update and let me know if you continue to see any issues.
 * Thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Limit Orders for WooCommerce] Orders have exceeded the limit](https://wordpress.org/support/topic/orders-have-exceeded-the-limit/)
 *  Plugin Contributor [Brian Watson](https://wordpress.org/support/users/bswatson/)
 * (@bswatson)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/orders-have-exceeded-the-limit/#post-12690106)
 * I believe we’ve tracked the source of this to a default limit on one of the queries.
   We’re writing the automated test now to confirm it and the fix and should have
   a new release out later today.

Viewing 15 replies - 1 through 15 (of 26 total)

1 [2](https://wordpress.org/support/users/bswatson/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/bswatson/replies/page/2/?output_format=md)