Better Coupon Restrictions

How can we help?

Search the documentation or ask the AI agent anything about the plugin.

Hooks and filters reference

Updated September 15, 2026

Better Coupon Restrictions provides filters for adding checks, changing which orders are counted, and controlling analytics and coupon links. All hooks below exist in version 2.0.0. Hooks marked PRO only run when PRO code is active.

Validation

  • bcrw_validation_checks ( array $checks, WC_Coupon $coupon ): the list of check callbacks run in order. See Add your own restriction check.
  • bcrw_validation_check_labels ( array $labels ): map of check function name to the label shown in the admin hint and analytics.
  • bcrw_coupon_restriction_value ( mixed $value, string $key, WC_Coupon $coupon ): filters every value read with bcrw_get_restriction(). PRO uses it to apply global settings.
  • bcrw_is_checkout_context ( bool $is_checkout ): whether the request is part of checkout, which controls when payment method rules apply.
  • bcrw_message_sections ( array $sections ): section keys and labels used for custom error messages.

Order counting

  • bcrw_countable_order_statuses ( array $statuses ): statuses, with the wc- prefix, counted as a use of a coupon by usage per period, per address and per IP. Cancelled, failed, trashed and refunded are excluded by default.
  • bcrw_purchase_order_statuses ( array $statuses ): statuses, without the prefix, that count as a purchase for New Customer Only and Minimum Total Customer Orders. Defaults to WooCommerce’s paid statuses plus refunded.

Stop pending payment orders counting towards usage limits:

add_filter( 'bcrw_countable_order_statuses', function ( $statuses ) {
    return array_values( array_diff( $statuses, array( 'wc-pending' ) ) );
} );

Admin hint and analytics

  • bcrw_show_admin_rejection_hint ( bool $show, WC_Coupon $coupon, callable|string $check ): return false to hide the shop manager line.
  • bcrw_rejection_analytics_enabled ( bool $enabled ): overrides the Rejection Analytics setting.
  • bcrw_log_rejections ( bool $log, WC_Coupon $coupon, callable|string $check ): return false to skip logging a particular rejection.
  • bcrw_rejection_retention_days ( int $days ): default 90. Return 0 to keep entries until cleared.
add_filter( 'bcrw_show_admin_rejection_hint', '__return_false' );
add_filter( 'bcrw_rejection_retention_days', function () {
    return 30;
} );

PRO

  • bcrw_link_coupon_param ( string $param ): the query parameter for coupon links, default coupon.
  • bcrw_domain_restrictions_in_use ( bool $in_use ): whether to set the referrer cookie.
  • bcrw_user_meta_key_allowed ( bool $allowed, string $key ): allow or block a key for Custom User Meta.
  • bcrw_settings ( array $settings ): the WooCommerce settings fields on the global settings tab.
add_filter( 'bcrw_link_coupon_param', function () {
    return 'promo'; // Links become ?promo=CODE
} );

Actions

  • bcrw_coupon_options_usage_restriction: runs at the top of the Better Coupon Restrictions tab panel. Use it to output extra fields.
  • bcrw_fs_loaded: fires after the licensing SDK has loaded.

Related

Was this article helpful?