Merge branch 'quantity-limit-fix' into 'master'
increase quantity limit in cart See merge request saburly/wiaas/new-wiaas!50
This commit was merged in pull request #50.
This commit is contained in:
@@ -248,6 +248,10 @@ class Wiaas_Cart {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function update_package_quantity($package_cart_item_key, $new_quantity) {
|
public static function update_package_quantity($package_cart_item_key, $new_quantity) {
|
||||||
|
if ($new_quantity > 65000){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$cart_item = WC()->cart->get_cart_item($package_cart_item_key);
|
$cart_item = WC()->cart->get_cart_item($package_cart_item_key);
|
||||||
|
|
||||||
if (!$cart_item) {
|
if (!$cart_item) {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export const cartMessages = {
|
|||||||
QUANTITY_UPDATED: "Quantity has been updated for the package!",
|
QUANTITY_UPDATED: "Quantity has been updated for the package!",
|
||||||
INVALID_PACKAGE_FOR_REMOVE: "This package is not available in your cart! In case this error persists contact Co-Market!",
|
INVALID_PACKAGE_FOR_REMOVE: "This package is not available in your cart! In case this error persists contact Co-Market!",
|
||||||
PACKAGE_REMOVED_FROM_CART: "The package has been removed from the cart!",
|
PACKAGE_REMOVED_FROM_CART: "The package has been removed from the cart!",
|
||||||
INVALID_QUANTITY: "The quantity can be a number between 1 and 100!",
|
INVALID_QUANTITY: "The quantity can be a number between 1 and 65000!",
|
||||||
CART_EMPTY: "You must have at least one package in the cart!",
|
CART_EMPTY: "You must have at least one package in the cart!",
|
||||||
NO_DELIVERY_ADDRESS: "No delivery address was added! Please fill the necessary info",
|
NO_DELIVERY_ADDRESS: "No delivery address was added! Please fill the necessary info",
|
||||||
INCOMPLETE_DELIVERY_ADDRESS: "Incomplete delivery address. Please review!",
|
INCOMPLETE_DELIVERY_ADDRESS: "Incomplete delivery address. Please review!",
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const coMarketMessages = {
|
|||||||
QUANTITY_UPDATED: "Quantity has been updated for the package!",
|
QUANTITY_UPDATED: "Quantity has been updated for the package!",
|
||||||
INVALID_PACKAGE_FOR_REMOVE: "This package is not available in your cart! In case this error persists contact the Co-Market!",
|
INVALID_PACKAGE_FOR_REMOVE: "This package is not available in your cart! In case this error persists contact the Co-Market!",
|
||||||
PACKAGE_REMOVED_FROM_CART: "The package has been removed from the cart!",
|
PACKAGE_REMOVED_FROM_CART: "The package has been removed from the cart!",
|
||||||
INVALID_QUANTITY: "The quantity can be a number between 1 and 100!",
|
INVALID_QUANTITY: "The quantity can be a number between 1 and 65000!",
|
||||||
CART_EMPTY: "You must have at least one package in the cart!",
|
CART_EMPTY: "You must have at least one package in the cart!",
|
||||||
NO_DELIVERY_ADDRESS: "No delivery address was added! Please fill the necessary info",
|
NO_DELIVERY_ADDRESS: "No delivery address was added! Please fill the necessary info",
|
||||||
INCOMPLETE_DELIVERY_ADDRESS: "Incomplete delivery address. Please review!",
|
INCOMPLETE_DELIVERY_ADDRESS: "Incomplete delivery address. Please review!",
|
||||||
|
|||||||
@@ -35,13 +35,13 @@ class CartItem extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isQuantityValid(quantity) {
|
isQuantityValid(quantity) {
|
||||||
return quantity > 0 && quantity <= 100;
|
return quantity > 0 && quantity <= 65000;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateQuantity(cartItem, quantity) {
|
updateQuantity(cartItem, quantity) {
|
||||||
if(quantity) {
|
if(quantity) {
|
||||||
this.setState({itemQuantity: quantity});
|
|
||||||
if(this.isQuantityValid(quantity)) {
|
if(this.isQuantityValid(quantity)) {
|
||||||
|
this.setState({itemQuantity: quantity});
|
||||||
this.sumPrices(cartItem, quantity);
|
this.sumPrices(cartItem, quantity);
|
||||||
this.props.dispatch(updateQuantity(cartItem, quantity));
|
this.props.dispatch(updateQuantity(cartItem, quantity));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user