CartAction
Last updated
Last updated
This is a special variable that determines how Fanplayr will treat cart-related data for the current user or order tracking call. It can be used to carry forward cart details (total value in cart, products in cart etc) from the previous page view if they are unavailable for the current tracking call.
If you do not have access to the contents of the cart, or getting the contents of the cart at each page view is expensive on server resources, then you can use cart actions to have our server handle this information for you. Simply add a cartAction
as follows:
For “add”, “subtract” and “set” the following will happen:
Start with the last tracked cart details.
Ignore all current cart details, except for products.
Do the specified action
Recalculate the totals of the cart based on the merged details.
Action
Description
Undefined or "override"
Default behavior. The server will override cart details with any data set on this request.
"repeat"
The server will use the previous pages cart details.
"add"
Add the current cart products to the last tracked products. Any products with the same id
will have their quantities added together.
"subtract"
Subtract the current cart products from the last tracked products. Any products with the same id
will have their quantities subtracted from each other and any products with resulting quantities that are zero or below will be removed.
"set"
For each previously tracked product, replace all details of any product with a matching id
of current products being tracked. Products that do not already exist will be added.