CartAction

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:

{
  accountKey: 'your_account_key',
  data: {
    // ...
    cartAction: '' <or> 'repeat' <or> 'add' <or> 'subtract' <or> 'set'
  }
}

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.

Last updated