How to use woocommerce_add_to_cart_validation

Before add to card in woocommerce if you need to custom validation than you can use woocommerce action woocommerce_add_to_cart_validation

by this action you can use validation.

there is 5 arguments. lets we understand one by one.

$true indicated to validation is true or false value

$product_id get product id which request for add to cart

$request_quantity get product qty

$variation_id that get to if variation id available than get it

lets we understand with example . we assume minimum item qty should be 10

this way you can be easy to understand how to work woocommerce_add_to_cart_validation action

Leave a Comment

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.