JSMA carts

Overview

What can JSMA carts do for me?

The JSMA carts provides access to the current cart (JSMA cart) of the session and allows to reset it.

Index

Methods

The JSMA carts provides the following methods:

cart carts.current

Returns the current cart (JSMA cart). Will create a cart object if none was created before internally.

Example

CartApi.prototype.doDecrementItemQuantity = function ()
{
  var itemId = request.parameter("itemId");
  
  [...]
    
  if (quantity <= 0) {
    carts.current.removeItem(itemId);
  }

  [...]
};

void carts.pickup(uuid)

Connects a cart (specified by uuid) to the current session.

Example

...
carts.pickup("CART_UUID");
...

Parameter uuid (required)

A string containing the uuid of a cart.

cart carts.findByUuid(uuid)

Retrieves a cart (specified by uuid) and returns it as a JSMA cart.

Example

...
carts.findByUuid(uuid) // => JSMA cart
...


Parameter uuid (required)

A string containing the uuid of a cart.

void carts.resetCurrentCart()

Resets the current cart. This method is called after an order has processed successfully.

Example

...
carts.resetCurrentCart()
...