1. Home
  2. Docs
  3. Doc of Maximum Products p...
  4. ShortCode
  5. Product Purchase Limit Shortcodes

Product Purchase Limit Shortcodes

AD 4nXe8x2Z8g5KPfncGOMVUYObZjsfJ2jTsMrh1JrZRvfI2IyOxX7uqW

Product Purchase Limit Shortcodes

These shortcodes allow you to manage and display product purchase limits for your customers based on various conditions and settings. Below are the detailed descriptions and usage examples for each shortcode.


1. [alg_wc_mppu_current_product_limit]

Description:
This shortcode displays the current product purchase limit for a specific user. It can be customized to show a message when certain conditions are met, such as when the remaining quantity is zero.

Parameters:

  • user_id (optional): Specifies the user ID to check the limit for. If not provided, the current logged-in user will be used.
  • condition (optional): Allows you to apply a condition for displaying the message. For example, you can use %remaining% == 0 to show the message only when the remaining quantity is zero.
  • msg_template (optional): Customizes the message template. The default template is <span class=”alg-wc-mppu-current-product-limit”>{output_msg}</span>.

Example Usage: [alg_wc_mppu_current_product_limit user_id="123" condition="%remaining% > 0" msg_template="You can purchase %remaining% more of this product."]

Use Case:
Display the remaining purchase limit for a specific user on a product page, allowing customers to see how many more units they can buy.


2. [alg_wc_mppu_user_product_limits]

Description:
This shortcode displays a list of products with their purchase limits for a user. It is useful for showing customers the limits that apply to the products they are interested in.

Parameters:

  • user_id (optional): Specifies the user ID to check the limits for. Defaults to the current user.
  • show_only_limited_products (optional): Set this to “true” to display only products that have purchase limits.
  • show_restrictions_col (optional): Adds a column to display any restrictions related to the products.
  • bought_value (optional): Determines how the bought value is calculated. Options include smart and per_product. The default is smart.
  • show_unbought (optional): Controls whether to show products that haven’t been bought yet. The default is true.
  • hide_products_by_id (optional): Allows you to hide specific products by their ID.

Example Usage: [alg_wc_mppu_user_product_limits user_id="123" show_only_limited_products="true" show_restrictions_col="true"]

Use Case:
Place this shortcode on the “My Account” page to allow users to see their product purchase limits in one convenient location.


3. [alg_wc_mppu]

Description:
This shortcode allows you to display or calculate product purchase limits using advanced formulas. It’s highly customizable and supports various parameters.

Parameters:

  • limit: Specifies the purchase limit.
  • term_id: Specifies the product term ID (e.g., category or tag).
  • product_id: Specifies the product ID.
  • limit_type: Defines whether the limit is grouped or individual.
  • start_date and end_date: Specifies the time range for the limit.
  • is_downloadable, is_virtual, product_sku: Additional parameters for advanced use.

Example Usage: [alg_wc_mppu limit="5" term_id="77,96" limit_type="grouped"]

Use Case:
Use this shortcode when you need to set complex purchase limits based on product IDs, categories, or other criteria.


4. [alg_wc_mppu_term_limit]

Description:
This shortcode displays the purchase limit for products within a specific term, such as a product category.

Parameters:

  • term_id: Specifies the term ID.
  • taxonomy: Specifies the taxonomy (e.g., product_cat for product categories).

Example Usage: [alg_wc_mppu_term_limit term_id="42" taxonomy="product_cat"]

Use Case:
Display purchase limits for all products within a specific category on a category page.


5. [alg_wc_mppu_placeholder]

Description:
A utility shortcode for displaying placeholders like %first_order_date%, %first_order_amount%, etc., within other content.

Example Usage: [alg_wc_mppu_placeholder]

Use Case:
Use this shortcode to insert dynamic information related to a user’s purchase history or product limits within custom messages.


6. [alg_wc_mppu_customer_msg]

Description:
This shortcode displays a customized message for customers based on their purchase behavior.

Parameters:

  • bought_msg: The message to display if the user has bought the product.
  • not_bought_msg: The message to display if the user has not bought the product.
  • bought_msg_min: Sets a minimum quantity that triggers the bought_msg.

Example Usage: [alg_wc_mppu_customer_msg bought_msg="Thank you for your purchase!" not_bought_msg="You haven't bought this product yet."]

Use Case:
Customize the user experience by showing different messages depending on whether a customer has purchased a specific product.


7. [alg_wc_mppu_user_terms_limits]

Description:
This shortcode displays purchase limits for user-specific terms, such as product categories or tags.

Parameters:

  • taxonomy: Defines the taxonomy to use (e.g., product_cat, product_tag).
  • show_unbought: Controls whether to show terms that haven’t been bought yet.

Example Usage: [alg_wc_mppu_user_terms_limits taxonomy="product_cat" show_unbought="true"]

Use Case:
Display purchase limits for product categories or tags on category pages or within the user’s account.

 

Maximum Products per User for WooCommerce

Tags