This section provides a powerful and flexible way to define purchase limits using shortcodes.
How it Works
- Enable: Activate this option to utilize formula-based limits.
- Formula: Enter one shortcode per line to define the limit logic.
Shortcode Details
- Use the [alg_wc_mppu] shortcode within your formula.
- The algorithm processes shortcodes sequentially, stopping at the first match (top to bottom).
Available Shortcode Attributes
- user_id: Specify user ID(s) (comma-separated) for the limit to apply.
- user_role: Define user role(s) (e.g., administrator, customer) for the limit.
- membership_plan (Requires additional integrations): Set limit based on membership plans (specific integrations might be required).
- (Several additional attributes related to memberships and payment methods)
- product_id (Requires enabling “Per product”): Set limit for specific product ID(s) (comma-separated).
- term_id (Requires enabling relevant taxonomy): Set limit for specific category/tag ID(s) (comma-separated).
- limit: This attribute is mandatory and specifies the maximum purchase quantity allowed.
Important Usage Notes
Attribute Requirements
- product_id (and related attributes) can only be used if “Per product” is enabled.
- term_id requires enabling the corresponding taxonomy (“Per product category” or “Per product tag”).
- payment_method requires enabling “Count by current payment method” and potentially disabling “Validate on add to cart” and “Block checkout page” for a smoother checkout experience.
- product_id and term_id cannot be used simultaneously in the same shortcode.
- Date Control: Define a timeframe for the shortcode using start_date, end_date, and not_date_limit attributes.
- product_limit_meta: This attribute can only be used in combination with product_id.
Examples
- [alg_wc_mppu limit=”18″ user_id=”2,5″]: 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″]: Sets a maximum limit of 18 for products 100 and 110 for users with IDs 2 and 5.
By leveraging shortcodes and their attributes, you can create highly customized purchase limits based on various criteria, providing more control over your WooCommerce store’s purchasing behavior.