• Resolved isonnymichael

    (@isonnymichael)


    Hi,

    I want to make custom error message woocommerce_coupon_error hooks with HTML tag.

    add_filter( 'woocommerce_coupon_error', array( $this, 'implement_coupon_error_message_block' ), 10, 3 );
    
    public function implement_coupon_error_message_block( $error_message, $error_code, $coupon ) {
        $error_message = "Custom message <a class='button'>Custom Button</a>"
        return $error_message;
    }

    The problem is on WooCommerce Blocks response API strip error_message:

    {
        "responses": [
            {
                "body": {
                    "code": "woocommerce_rest_cart_coupon_error",
                    "message": "Custom message Custom Button",
                    "data": {
                        "status": 400
                    }
                },
                "status": 400,
                ...
        ]
    }

    Is it possible to force return html tag on response woocommer blocks API? because in legacy WooCommerce page is working.

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Handling woocommerce_rest_cart_coupon_error response JSON with HTML’ is closed to new replies.