Support » Plugin: Limit Orders for WooCommerce » Show order limit in hoime page

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Steve Grunwell

    (@stevegrunwell)

    Hi Roberto,

    You can use the Nexcess\LimitOrders\OrderLimiter class to get details about the order limiter and its settings.

    For example:

    $limiter   = new \Nexcess\OrderLimiter\Limiter();
    $limit     = $limiter->get_limit();
    $remaining = $limiter->get_remaining_orders();
    $resets    = $limiter->get_next_interval_start();
    
    echo "Heads up, we only accept {$limit} orders a day, and only {$remaining} slots are remaining!";
    echo "Missed your chance? We start taking orders again at {$resets->format( 'g:ia T')}!";

    Thanks for reaching out!

    @stevegrunwell

    Hi Steve, I’m using your great plugin. Thank you…

    I would like to ask you how works your example. I don’t know how to show number of remanining order slots e.g. on home page (like Roberto).

    On my e-shop I’m using a WP Bakery Page builder. Can you give me some solution (e.g. via shortcode and function.php), please? I’m a beginner in this direction.

    Thank you, Roman

    Plugin Author Steve Grunwell

    (@stevegrunwell)

    @romeirocze This may help you, an add-on plugin that registers a new [limit-orders] shortcode: https://gist.github.com/stevegrunwell/393dc9ea09527c344b2b227c552c11e0

    Variables within the shortcode content will go through the same replacement process that happens for other messages within Limit Orders. For example:

    [limit-orders]We can only accept {limit} orders per hour. We'll begin accepting orders again at {next_interval:time} {timezone}.[/limit-orders]

    Will be rendered as:

    We can only accept 50 orders per hour. We’ll begin accepting orders again at 1:00 pm EDT.

    • This reply was modified 4 months, 2 weeks ago by Steve Grunwell. Reason: Add link to variable documentation

    @stevegrunwell Ooooh, works great! Thank you so much! 😉

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.