Hooks and filters reference #
Maximum Products per User for WooCommerce exposes a set of actions and filters so developers can adjust limits, counting and messaging in code. As of version 4.5.0 the hook names use the wpfmppu_ prefix. The older alg_wc_mppu_* names still fire as deprecated aliases (they emit _deprecated_hook() notices), so target the current names in new code.
Actions #
| Hook | Fires |
|---|---|
wpfmppu_core_loaded |
After the core class is loaded. |
wpfmppu_after_save_settings |
After the settings page is saved. |
wpfmppu_order_data_saved |
After an order’s sales data is stored. |
wpfmppu_before_block_guest_on_add_to_cart |
Before a guest is blocked at add to cart. |
Core limit and counting filters #
| Filter | Purpose |
|---|---|
wpfmppu_get_max_qty |
Filter the computed maximum quantity for a product or term. |
wpfmppu_get_max_qty_for_product |
Filter the max quantity resolved for a specific product. |
wpfmppu_max_qty_by_formula |
Filter the limit returned by a formula rule. |
wpfmppu_user_already_bought |
Filter the “already bought” figure for a user. |
wpfmppu_user_already_bought_validation |
Filter whether an “already bought” record passes validation. |
wpfmppu_user_already_bought_do_count_order |
Control whether an order counts toward the total. |
wpfmppu_check_quantities_for_product |
Filter the quantity check for a product. |
wpfmppu_check_quantities_for_product_valid |
Filter whether a product’s quantity check is valid. |
wpfmppu_check_quantities_guest_limits |
Filter guest limit checks. |
wpfmppu_skip_all_products_for_product |
Skip the All Products limit for a given product. |
wpfmppu_validate_on_add_to_cart_quantity, wpfmppu_validate_on_add_to_cart_quantity_do_add |
Adjust add-to-cart validation quantities and behavior. |
wpfmppu_save_quantities_item_qty |
Filter the quantity stored per order item. |
wpfmppu_orders_data_increase_qty, wpfmppu_totals_data, wpfmppu_totals_data_increase_qty, wpfmppu_totals_data_decrease_qty |
Filter stored orders/totals data as it is increased or decreased. |
Guest and blocking filters #
| Filter | Purpose |
|---|---|
wpfmppu_is_product_blocked_for_guests |
Filter whether a product is blocked for guests. |
wpfmppu_is_product_blocked_for_guests_by_limit_options |
Filter guest blocking under the “According to limit options” method. |
wpfmppu_local_enabled, wpfmppu_product_cat_enabled, wpfmppu_product_tag_enabled |
Report whether Per product / category / tag limits are active (return yes/no). |
wpfmppu_settings |
The Pro gate. Returns true and, for option fields, the disabled attribute array in the free version. |
Date, cart and message filters #
| Filter | Purpose |
|---|---|
wpfmppu_date_range |
Filter the effective date range. |
wpfmppu_date_to_check |
Override the date used for range checks (use priority 1000 or higher, and enable “Date to check” in Advanced). |
wpfmppu_datetime_to_compare |
Override the current time used in comparisons (driven by Advanced > Current time offset). |
wpfmppu_get_monthly_range_origin_date |
Filter the origin date for the Monthly range. |
wpfmppu_cart_item_amount, wpfmppu_get_cart_item_amount_by_parent, wpfmppu_get_cart_item_amount_by_term, wpfmppu_get_cart_item_quantities |
Filter cart item amounts and quantities used in limit maths. |
wpfmppu_get_notice_placeholders |
Filter the placeholder values used in messages. |
wpfmppu_get_first_order_date_exp |
Filter the computed first-order expiry date. |
wpfmppu_output_notices_args |
Filter arguments used when outputting notices. |
wpfmppu_profile_page_table_row |
Filter a row in the user profile sales-data table. |
wpfmppu_user_product_limits_item_validation, wpfmppu_user_product_limits_query_args, wpfmppu_user_terms_limits_item_validation |
Filter items and queries used by the My Account limit tables. |
wpfmppu_calculate_data_wc_get_orders_args, wpfmppu_data_product_or_term_id |
Filter recalculation query args and the product/term id used for data. |
wpfmppu_bkg_process_email_params |
Filter the background-process completion email. |
Example: raise the limit for a specific user #
add_filter( 'wpfmppu_get_max_qty_for_product', function ( $max_qty, $product_id, $user_id ) {
if ( 123 === (int) $user_id ) {
$max_qty = 50; // VIP user
}
return $max_qty;
}, 10, 3 );
Argument counts vary per hook; confirm the callback signature against the source before relying on later parameters.
Deprecated hook names #
Maximum Products per User for WooCommerce
Get more from Maximum Products per User for WooCommerce
See every feature and the pricing on the Maximum Products per User for WooCommerce plugin page.
Old hook names such as alg_wc_mppu_get_max_qty, alg_wc_mppu_settings and alg_wc_mppu_user_already_bought map to their wpfmppu_* equivalents and still run for backward compatibility, logging a deprecation notice. Migrate to the current names.
Need a hand? #
Our team answers every ticket on the Maximum Products per User support forum.