How to Gets the lines in the cart.

Description: Gets the lines in the cart.

var cart = container.getComponent("Cart");
			cart.getLines().then(function(lines) {

					if (lines.length > 100) {
						throw new Error("You are ordering a lot of stuff. For high-volume orders, contact our sales team on 555-123-1234.");
					}
			});

Returns a Deferred object. If the promise is resolved, it returns the lines in the cart (an array of Line objects). Otherwise, the promise returns the rejected state.

Leave a comment

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