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.
- $yes_get_option_woocommerce_enable_coupons = apply_filters( 'woocommerce_coupons_enabled', $yes_get_option_woocommerce_enable_coupons );
- if ( !empty( $yes_get_option_woocommerce_enable_coupons ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the woocommerce_coupons_enabled callback
- function filter_woocommerce_coupons_enabled( $yes_get_option_woocommerce_enable_coupons ) {
- // make filter magic happen here...
- return $yes_get_option_woocommerce_enable_coupons;
- };
- // add the filter
- add_filter( 'woocommerce_coupons_enabled', 'filter_woocommerce_coupons_enabled', 10, 1 );
- To remove a hook callback, use the example below.
- // remove the filter
- 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
- return apply_filters( 'woocommerce_coupons_enabled', 'yes' === get_option( 'woocommerce_enable_coupons' ) );