Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
linenumberstrue
// we either update a cart item
if (request.parameter('replaceItem')) {
  cartItem = carts.current.updateItem(productId, request.parameter('project'), request.parameter('replaceItem'));
}
// or add a new one.
else {
  cartItem = carts.current.addItem(productId, request.parameter('project')); // => cartItem
}

Parameter int product_id (required)

The id of the product

Parameter project (optional)

The project object

Parameter int custom_price (optional)

The price in cent

cartItem cart.addItemFromOrderItem(item_uuid)

...

Code Block
languagejs
linenumberstrue
// we either update a cart item
if (request.parameter('replaceItem')) {
  cartItem = carts.current.updateItem(productId, request.parameter('project'), request.parameter('replaceItem')); 
}
// or add a new one.
else {
  cartItem = carts.current.addItem(productId, request.parameter('project'));
}

Parameter int product_id (required)

The id of the product

Parameter project (required)

The project object

Parameter uuid (required)

The uuid of the item

string cart.uuid

Returns the cart's uuid.

...