samples/pantheon.js
function addProductToCart(url, productID, formID, formBuildID, formToken) {
	let formdata = {
		product_id: productID,
		form_id: formID,
		form_build_id: formBuildID,
		form_token: formToken,
		quantity: 1,
		op: "Add to cart",
	};
	let headers = { "Content-Type": "application/x-www-form-urlencoded" };
	let res = http.post(url, formdata, { headers: headers });
	// verify add to cart succeeded
	check(res, {
		"add to cart succeeded": (res) => res.body.includes('Item successfully added to your cart')
	}) || fail("add to cart failed");
}
function addProductToCart(url, productID, formID, formBuildID, formToken) {
	let formdata = {
		product_id: productID,
		form_id: formID,
		form_build_id: formBuildID,
		form_token: formToken,
		quantity: 1,
		op: "Add to cart",
	};
	let headers = { "Content-Type": "application/x-www-form-urlencoded" };
	let res = http.post(url, formdata, { headers: headers });
	// verify add to cart succeeded
	check(res, {
		"add to cart succeeded": (res) => res.body.includes('Item successfully added to your cart')
	}) || fail("add to cart failed");
}
function addProductToCart ( url , productID , formID , formBuildID , formToken ) { let formdata = { product_id : productID , form_id : formID , form_build_id : formBuildID , form_token : formToken , quantity : 1 , op : "Add to cart" , } ; let headers = { "Content-Type" : "application/x-www-form-urlencoded" } ; let res = http . post ( url , formdata , { headers : headers } ) ; // verify add to cart succeeded check ( res , { "add to cart succeeded" : ( res ) => res . body . includes ( 'Item successfully added to your cart' ) } ) || fail ( "add to cart failed" ) ; }
Add a product to our shopping cart
Add a product to our shopping cart