1. Home
  2. Docs
  3. Maximum Products per User...
  4. How To
  5. Limits by Formula: Advanced Control for Maximum Products per User

Limits by Formula: Advanced Control for Maximum Products per User

IRXPLevSRlCk3afKEJZUe eb1UqCdMLL5 b9RXUWanL8CBXKLlyZLGcTPvNuKluV6C yNhlk

The “Maximum Products per User” plugin for WooCommerce offers an advanced feature called “Limits by Formula.” This empowers you to define purchase limits using shortcodes and custom logic.

Enabling Formulas

  • Enable: Check this box to activate the “Limits by Formula” section.

Formula Construction

  • Formula: This is where you define your limit logic using shortcodes. Each shortcode is written on a separate line.

Important Notes

  • [alg_wc_mppu] Shortcode: This is the core shortcode you’ll use within your formulas.
  • Matching Logic: The algorithm stops when it encounters the first matching shortcode, reading from top to bottom.
  • Available Attributes: The plugin provides various attributes within the shortcode to target specific user groups, products, and purchase conditions.

Here are some key attributes

  • user_id: Define limits for specific user IDs (comma-separated).
  • user_role: Set limits based on user roles (e.g., administratorcustomer).
  • membership_planmemberpress_plan_id, etc.: (Requires additional membership plugins) Define limits based on membership plans.
  • payment_method: Set limits based on the chosen payment method (requires enabling “Count by current payment method”).
  • product_idproduct_skuis_downloadableis_virtual: Define limits for specific products or product types (requires enabling “Per product”).
  • term_id: Set limits for products within specific categories or tags (requires enabling “Per product category” or “Per product tag”).

Additional Considerations

  • The limit attribute is mandatory and specifies the maximum purchase quantity allowed.
  • You can set start and end dates for the shortcode to define limited-time offers or restrictions.
  • The product_limit_meta attribute allows you to use custom product meta data in your formulas (only combined with product_id).

Examples

  • [alg_wc_mppu limit=”18″ user_id=”2,5″]: This sets a maximum limit of 18 for users with IDs 2 and 5.
  • [alg_wc_mppu limit=”18″ user_id=”2,5″ product_id=”100,110″]: This sets a maximum limit of 18 for products 100 and 110 for users with IDs 2 and 5.

By leveraging “Limits by Formula,” you can create highly customized purchase restrictions, catering to various user segments, product types, and promotional periods within your WooCommerce store.

 

Maximum Products per User for WooCommerce

Tags