Created
February 9, 2017 17:49
-
-
Save wpeliteplugins/44105d980f86dc334403caa6f580bedb to your computer and use it in GitHub Desktop.
Change error message - WooCommerce minumum/maximum quantities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// To change error message: | |
// The minimum allowed quantity for ABC is 5 (you currently have x in your cart). | |
add_filter('woo_min_allowed_product_qty_err', 'woo_min_allowed_product_qty_err_message', 10, 4 ); | |
function woo_min_allowed_product_qty_err_message( $err_msg, $_product, $minimum_quantity, $in_cart ) { | |
$err_msg = __( 'Your message here', 'woo_min_max_quantities' ); | |
return $err_msg; | |
} | |
// To change error message: | |
// The maximum allowed quantity for ABC is 40 (you currently have x in your cart). | |
add_filter('woo_max_allowed_product_qty_err', 'woo_max_allowed_product_qty_err_message', 10, 4 ); | |
function woo_max_allowed_product_qty_err_message( $err_msg, $_product, $maxumum_quantity, $in_cart ) { | |
$err_msg = __( 'Your message here', 'woo_min_max_quantities' ); | |
return $err_msg; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to add this code in your theme functions.php file.