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.9.8.1

apply_filters('woocommerce_apply_with_individual_use_coupon') is found 2 times:

  • /includes/class-wc-cart.php line 1808
    1804
    1805
    1806
    1807
    1808
    1809
    1810
    1811
    1812
    1813
    1814
    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 1028
    1024
    1025
    1026
    1027
    1028
    1029
    1030
    1031
    1032
    1033
    1034
    * @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 */
                esc_html__( '"%s" has already been applied and cannot be used in conjunction with other coupons.', 'woocommerce' ),
                esc_html( $code )