• Resolved angstack77

    (@angstack77)


    Hi, I’ve added your plugin to my site but I want to limit the amount of orders per 15 minute slot… is that possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Steve Grunwell

    (@stevegrunwell)

    Hi @angstack77,

    Out-of-the-box, Limit Orders for WooCommerce comes with hourly, daily, and monthly intervals. However, we do offer a number of filters (and some example code) to enable store owners to add their own custom intervals.

    These filters could be added to your active theme or, if you’d prefer, written as a custom plugin.

    I’ve taken the liberty of putting together a single-page plugin that adds an “Every 15min Interval” to Limit Orders. You can grab this file directly from the Gist and install it into wp-content/plugins on your store, then activate it from within WP Admin the same way you would any other plugin.

    Thanks both for reaching out and using Limit Orders for WooCommerce!

    Hi Steve

    Greetings from the UK and thanks for a great free plugin which could possibly save my life on a pizza delivery website I am developing!!

    So question … re minute intervals … I need 30! I have taken the 15 minute plugin and changed every instance of ’15’ to ’30’ … Have re-zipped and installed into my Woocommerce / WP site, which appears to have all gone smoothly … it was just a quick question … Is this likely to work or am I being too smart for my own good??!!

    I am far from a php guru, just know how to edit in a logical way! many thanks

    Will

    Plugin Contributor Steve Grunwell

    (@stevegrunwell)

    Hey @williamlowdell2020, I’m so glad to hear that Limit Orders is helping you out!

    I went back through the Gist from above and yes, changing instances of “15” to “30” should do the trick ??

    If you want a more complete explanation, I’m documenting it here (and will link to this post from the gist):

    To create custom intervals using that gist as a starting point, the key lines of code (excluding inline documentation, which should also be updated to match) are:

    • Lines 18, 22, 37, and 59 need to be consistent; these can technically be anything you want (e.g. “30min”, “halfHour”, “pizzaTime”, etc.), but they’re used to tell the plugin which interval has been selected.
    • Line 43 should have both instances of “15” updated; this line gets the current number of minutes past the hour (0-59), divides it by the interval (in your case, 30), rounds that value down to the nearest integer (using 30, this will always be either a 0 or a 1), then multiplies that integer by the interval (e.g. 0 or 30).
    • Line 63 is responsible for determining when the next interval will begin. This uses PHP’s DateInterval class: “PT15M” can be read as “Period Time 15 Minutes”. For a half-hour, the interval would be “PT30M”. Be very careful not to omit the “T”, however, as “P30M” (no “T”) would mean 30 months, which is probably not what you’re looking for ??
    • This reply was modified 4 years, 10 months ago by Steve Grunwell. Reason: We're talking about the DateInterval class, not an instance of the object
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘limit per minute’ is closed to new replies.