woocommerce_coupon_validate_maximum_amount

The WooCommerce woocommerce coupon validate maximum amount hook.

Description

apply_filters( 'woocommerce_coupon_validate_maximum_amount', (number) $this_get_maximum_amount_wc_cart_get_displayed_subtotal, (unknown) $instance ); 

Parameters (2)

0. $this_get_maximum_amount_wc_cart_get_displayed_subtotal (number)
The this get maximum amount wc cart get displayed subtotal.
1. $instance (unknown)
The instance.

Usage

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

Defined (1)

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

/includes/class-wc-coupon.php  
  1. if ( $this->get_maximum_amount() > 0 && apply_filters( 'woocommerce_coupon_validate_maximum_amount', $this->get_maximum_amount() < WC()->cart->get_displayed_subtotal(), $this ) ) {