woocommerce_apply_with_individual_use_coupon

woocommerce_apply_with_individual_use_coupon

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

apply_filters('woocommerce_apply_with_individual_use_coupon') is found 2 times:

  • /includes/class-wc-cart.php line 1795
    		if ( $this->applied_coupons ) {
    			foreach ( $this->applied_coupons as $code ) {
    				$coupon = new WC_Coupon( $code );
    
    				if ( $coupon->get_individual_use() && false === apply_filters( 'woocommerce_apply_with_individual_use_coupon', false, $the_coupon, $coupon, $this->applied_coupons ) ) {
    
    					// Reject new coupon.
    					$coupon->add_coupon_message( WC_Coupon::E_WC_COUPON_ALREADY_APPLIED_INDIV_USE_ONLY );
    
    					return false;
    				}
    
  • /src/StoreApi/Utilities/CartController.php line 963
    			 * @param \WC_Coupon $individual_use_coupon Individual use coupon already applied to the cart.
    			 * @param array $applied_coupons Array of applied coupons already applied to the cart.
    			 * @return boolean
    			 */
    			if ( false === apply_filters( 'woocommerce_apply_with_individual_use_coupon', false, $coupon, $individual_use_coupon, $applied_coupons ) ) {
    				throw new RouteException(
    					'woocommerce_rest_cart_coupon_error',
    					sprintf(
    						/* translators: %s: coupon code */
    						__( '"%s" has already been applied and cannot be used in conjunction with other coupons.', 'woocommerce' ),
    						$code