woocommerce_coupons_enabled

Check if coupons are enabled.

Description

(array) apply_filters( 'woocommerce_coupons_enabled', (string) $yes_get_option_woocommerce_enable_coupons ); 

Filterable.

Returns (array)

Parameters (1)

0. $yes_get_option_woocommerce_enable_coupons — Optional. (string) => 'yes' === get_option( 'woocommerce_enable_coupons' )
The yes get option woocommerce enable coupons.

Usage

To run the hook, copy the example below.
  1. $yes_get_option_woocommerce_enable_coupons = apply_filters( 'woocommerce_coupons_enabled', $yes_get_option_woocommerce_enable_coupons ); 
  2.  
  3. if ( !empty( $yes_get_option_woocommerce_enable_coupons ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_coupons_enabled callback 
  2. function filter_woocommerce_coupons_enabled( $yes_get_option_woocommerce_enable_coupons ) { 
  3. // make filter magic happen here... 
  4. return $yes_get_option_woocommerce_enable_coupons
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_coupons_enabled', 'filter_woocommerce_coupons_enabled', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_coupons_enabled', 'filter_woocommerce_coupons_enabled', 10, 1 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/wc-coupon-functions.php  
  1. return apply_filters( 'woocommerce_coupons_enabled', 'yes' === get_option( 'woocommerce_enable_coupons' ) );