• Resolved eli0086

    (@eli0086)


    Is there any way to modify the plugin to check for the dollar amount instead of number of orders? Or possibly number of items sold?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Brian Watson

    (@bswatson)

    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.

    Plugin Contributor Steve Grunwell

    (@stevegrunwell)

    Hi @eli0086,

    I wanted to let you know that I’ve opened a PR on the plugin’s GitHub repo that adds filters making it easy to customize which orders count against the limit.

    Once these filters are available, you could use the “limit_orders_pre_count_qualifying_orders” filter to sum the totals of orders you’ve received so far and, if it meets or exceeds your limit, return a value greater than or equal to the order limit set on your store).

    For example:

    add_filter( 'limit_orders_pre_count_qualifying_orders', function ( $preempt, $limiter ) {
      $limit = 1000; // Assume a $1000 limit.
      $total = some_function_that_calculates_total_sales_for_period();
    
      // If we've met our limit, return the maximum number of orders accepted.
      return $total >= $limit ? $limiter->get_limit() : false;
    }, 10, 2 );

    Thank you for reaching out!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Limit by dollar amount?’ is closed to new replies.