Min and Max Purchase for WooCommerce


Plugin Description

Min and Max Purchase for WooCommerce (free) allows you to set up minimum and maximum purchase rules for products in your WooCommerce 1.0+ store. Purchases must meet these rules to proceed to checkout payment.

Now with Custom Messaging! You can enter your own custom error message by rule.

In the free plugin, rules search by Role/Membership or 'Not logged in' status.     (see the Pro Plugin for all search options).

If a purchase in your store fails a min and max purchase rule, an error message appears at the top of the checkout page, identifying the error situation and rule requirements. The customer must resolve the error, before the purchase can be completed.

Changelog Info
  • 1.0 - 2013-01-15 * Initial Public Release

Tutorials

.

Set Up a Basic Min and Max Purchase Rule

How does the rule choose what to look at in the cart? [Search Criteria]

  • By Role/Membership

(all other possible criteria available in the Pro Plugin)

Role/Membership is used within Wordpress to control access and capabilities, when a role is given to a user. Wordpress assigns certain roles by default such as Subscriber for new users or Administrator for the site's owner. Roles can also be used to associate a user with a pricing level. Use a role management plugin like User Role Editor to establish custom roles, which you can give to a user or class of users. Then you can associate that role with a Min and Max Purchase Rule. So when the user logs into your site, their Role interacts with the appropriate Rule.

How is the rule applied to the cart search results? [Rule applied to]

  • All – work with the total of the units/prices
  • Each – apply the rule to each product in the Rule Population
  • Any – Same as each, but limits the rule testing to the first X number of products

Does the Rule apply to Units Quantity amount or Price amount?

  • Units Quantity Amount
  • Price Amount

Here’s a sample of a min and max purchase rule:

  • If the purchaser is a Subscriber - [search criteria:Subscriber]
  • The min and max total for all purchases - [rule applied to: all]
  • Must be less than $20. - [price amount: $20]

Set Up a 'Cart Contents' Rule

Use Cart Search Criteria of 'Not Logged In'

  • in Cart Search Criteria Box
  • in membership List by Role Box
  • Select 'Not logged in (just visiting)'

With this set up, the rule will act as if it were an 'Apply to all products in the cart' selection, for any customer who is not logged in. This will be very useful, as many stores do not require a login to make a purchase. Equally, similar rules can be set up for specific roles.


Documentation

Min and Max purchase rules are applied at checkout time. They are a tested against the cart contents, and if the purchase fails a rule, an error message is produced. And even if the 'continue to payment button' is selected, checkout won't proceed until the error is resolved.

Plugin Requirements

  • WooCommerce 1.0+
  • WordPress 3.3+
  • PHP 5+

Plugin Options

If a purchase in your store fails a min and max purchase rule, an error message appears at the top of the checkout page, identifying the error situation and rule requirements. The customer must resolve the error, before the purchase can be completed.

Show Error Messages in Table Format

Error message formatting is offered in text style by default (value="no"), and in table format as an option.

Show Error Messages Just Before Checkout Products List

The error message can be show in two places - just before the checkout products list, and just before the checkeout address area. This option sets the error message to display before the products list.

Show Error Messages Just Before Checkout Products List - HTML Selector

For the Product area error message, this option supplies the ID or Class HTML selector this message appears before. This selector would appear in your theme"s checkout area, just above the products display area. Be sure to include the "." or "#" selector identifier before the selector name.
Default value = ".checkout_cart".

Show Error Messages Just Before Checkout Address List

The error message can be show in two places - just before the checkout products list, and just before the checkeout address area. This is the 2nd second option showing the error message, and becomes particularly useful if your theme's checkout is a multi-pane design.

Show Error Messages Just Before Checkout Address List - HTML Selector

For the Address area error message, this option supplies the ID or Class HTML selector this message appears before. This selector would appear in your theme"s checkout area, just above the products display area. Be sure to include the "." or "#" selector identifier before the selector name.
Default value = ".wpsc_checkout_forms".

Show Rule ID in Error Message

There is an option to show the rule id in the error message. This is useful in testing to track error messages back to their originating rule.

Show Product Category Names in Min and Max Purchase Error Message (Pro Only)

This (Pro Only) option allows the display of Product Category names in the error message, if error message criteria is included. This more full explanation of the rule criteria will help the customer resolve any errors.

Show Rule Category Names in Min and Max Purchase Error Message (Pro Only)

This (Pro Only) option allows the display of Min and Max Purchase Rule Category names in the error message, if error message criteria is included. This more full explanation of the rule criteria will help the customer resolve any errors.

Custom Min and Max Purchase Error Message CSS, used at checkout time

There's an option to customize the css of the error message format chosen. Simply place the css in the option field, and it will override the standard css.

Select a Currency Sign

Error message currency sign can be selected from the options available.

Apply More Than 1 Rule to Each Product

Do we apply multiple min and max purchase rules to EACH product in the cart? If not, we apply the FIRST rule we process which applies to a given product. It is ***Strongly Suggested*** that this option be set to "NO", as otherwise the compounding error messages could be quite confusing for the ecommerce customer.

Test Debugging Mode Turned On

The final option turns on the debugging mode. This mode will print to screen all of the structures used in rule testing and error message creation. Only use during testing.


The killer buttons at the bottom of the options screen

Use these buttons wisely. Great to clear out test rules or repair errant structures. Very powerful, handle with care.


Video Tutorials


Installation Instructions

Download and install from WordPress.Org

  1. Use the built-in WordPress plugin installer to download, install and activate the Free version of the plugin hosted at wordpress.org/extend/plugins/min-and-max-purchase-for-woocommerce
  2. Please Note: WooCommerce 1.0 or above is needed to run this plugin successfully.


Tips and Tricks


All Products in Cart - a Venn Diagram

A diagram representing how the 'all products in cart' search criteria works with the cart itself.


Role Setup and Usage in Search Criteria

Role Setup

Role/Membership is used within Wordpress to control access and capabilities, when a role is given to a user. Wordpress assigns certain roles by default such as Subscriber for new users or Administrator for the site's owner. New Roles with unique names can be created using a role manager plugin. (As these new new roles are used for search criteria rather than access level, the new roles can have the lowest possible access level.)

Role Usage

Roles have a separate use as well. Think of it as 'logged in as ...' or 'not logged in'. So if a user is 'not logged in', that means the rule applies to anything they buy. Converserly, your store can used the logged in state to separate out tiers of rules. If the user is 'logged in as XXX', any rule with Role XXX in the rule search criteria will be tested against that user's cart contents.

When roles are selected as the sole group criteria, "OR" must be selected in the "And/OR" relationship box just to the left of the Role selection box. Otherwise an error message will be produced, requiring that a category be selected.


All in Population - Error Message Results

When "all in population" is chosen, the rule acts on the totals of the population found to match the rule search criteria.


Each/Any in Population - Error Message Results

When "each in population" or "any in population" is chosen, the rule acts on each individual product in the population found to match the rule search criteria.


Fix Options Setup Page Problems (Reset to Defaults)

If the options setup is irretrievably messed up, there's an easy fix solution:

  • Take a snapshot of your existing setup, to allow you to recover any settings you'd like from the current setup.
  • Find the "Reset to Defaults" button (just below the "save changes" button)
  • Hit the button and all will be returned to default settings.
  • Re-apply those settings updates you desire.


Show all Internal Data in Debugging Mode

If there are any issues that pop up during testing your Min and Max Purchase rules, you have the option of turning on Debugging Mode. With Debugging Mode on, all of the rule, cart and decision structures used internally during processing are printed to the screen.

Screenshots




12 Responses to Min and Max Purchase for WooCommerce

  1. Can you use this to force them to buy X number or products per category? So they can buy different products but they have to be in the same category.


    • admin

      Hi Jason,
      Thanks for your query. You can’t do this out of the box with the plugin, but there is a wordpress filter function in the plugin which will allow you to code your specific requirements, per rule.
      Best,
      Vark


  2. Martin

    Its possible limit one product per vendor o something similar? (Sorry my english)


    • admin

      Hi Martin,
      Don’t really understand the question… perhaps you could compose the question precisely in your language, then run it through google translate…
      Best,
      Vark


  3. sonya

    I need a plugin that will allow products in my shop to be limited to one sale each per user. Can your plugin do this?


    • admin

      Hi Sonya,
      Thanks for your query. Yes, Min and Max purchase will do that for you, using a Lifetime rule. If each product needs its own individual limit, then each product would need an individual Lifetime rule.
      Best,
      Vark


      • sonya

        That’s great news, but can i just check, can i set it so every product is included in a ‘rule’, or will I need to create a rule for each individual product separately?

        Thanks


        • admin

          Hi Sonya,
          No worries. You can actually do it in a single rule. You’d set it up with the following parameters:
          Max purchase limit
          Lifetime purchases
          apply to all products in cart
          Each in population
          qty of 1
          And Bob’s your Uncle!
          Best,
          Vark


  4. sonya

    I can’t begin to tell you how happy I am :) Thank you so much, buying now :)

  5. Hi, I want to create a sitewide rule stating there is a maximum of 4 products allowed to be ordered in a single transaction.

    I set up a rule but it doesn’t seem to be applying itself. Do I have to check the tick box on each product page that says ‘Min and Max Purchase Category’? or does my single rule apply itself to the whole site automatically?

    Like I say, I want the rue to apply to the whole shop, no matter what category each product is in.

    I’m using the free version of the ‘Min and Max Purchase for WooCommerce’ plugin.

    Thanks


    • admin

      Hi,
      Thanks for your query. It sounds like another module is conflicting with Min and Max Purchase. A way to test this is to temporarily deactivate all plugins except Woo and Min/max, and also switch to a clean default theme, like 2014. Test. If good, add back 1 module. Retest. Keep adding back one module at a time until the conflict is identified.

      If you’d like 1-on-1 assistance, please contact me through my support channel here: http://www.varktech.com/support/

      Thanks,
      Vark

Leave a Comment

Your email address will not be published. Required fields are marked *

*


*