Updates the quantity of the item on the product details page.

setQuantity(quantity )

Description

Updates the quantity of the item on the product details page. For example, if the quantity is currently 2 and you call setQuantity(4), the quantity is changed to 4. This method only works if the current view is a PDP.

var pdp = container.getComponent('PDP');
			var newquantity = 2;

			pdp.on('beforeQuantityChange', function(event) {
			  if (!_.isNumber(newquantity)) {
			    alert('That is not a valid quantity.');
			    return false;
			  }
			});

Leave a comment

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