When a service is added to the basket, the user fills in the fields and when you click the Add to order button (this is essentially add to the basket), the field is filled in (for clarity, I simplified it to the if ($ a === 1) condition)

function so_validate_add_cart_item($true,$data){ $a = 1; if( $a === 1){ $true = 0; return $true; } } add_filter( 'woocommerce_add_to_cart_validation', 'so_validate_add_cart_item', 10, 5 ); 

Everything works well and the service is not added, but the page reloads.

the default is $ true = 1, but tried to return false - the same thing, the page is being overloaded.

How to stop the reloading of the page is not completely, but under certain conditions, and preferably in this hook?

    0