woocommerce_coupon_is_valid
The WordPress Core woocommerce coupon is valid hook.
Description
Parameters (2)
- 0. $true (bool) =>
true
- The true.
- 1. $instance (unknown)
- The instance.
Usage
- To run the hook, copy the example below.
- $true = apply_filters( 'woocommerce_coupon_is_valid', $true, $instance );
- if ( !empty( $true ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the woocommerce_coupon_is_valid callback
- function filter_woocommerce_coupon_is_valid( $true, $instance ) {
- // make filter magic happen here...
- return $true;
- };
- // add the filter
- add_filter( 'woocommerce_coupon_is_valid', 'filter_woocommerce_coupon_is_valid', 10, 2 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'woocommerce_coupon_is_valid', 'filter_woocommerce_coupon_is_valid', 10, 2 );
Defined (1)
The filter is defined in the following location(s).
- /includes/class-wc-coupon.php
- if ( ! apply_filters( 'woocommerce_coupon_is_valid', true, $this ) ) {