Versions Compared


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

The shopping cart for the current user should always be retrieved with the Ensure Active Cart Exists process flow.  This process flow will create the Web Shopping Carts record for the user if it doesn't exist and create a default order object.  There is a rule step for assigning default values on the order.  The order backing the cart is not persisted to the Orders entity until checkout when payment is applied.   The Web Shopping Carts entity plugin is responsible for syncing the order XML to its record.  If changes are made to the shopping cart's order as a result of business logic, you should always save the cart to persist the XML.  

titleWorking with the cart

Remember: retrieve the cart, manipulate the order, save the cart. When in doubt look at what existing stock end points endpoints are doing.

Determining the Current Users Cart


A user does not need to be authenticated to add to their cart.  Aptify now assigns unique anonymous tokens to unauthenticated users.  These tokens are assigned to the cart in the TokenId field as part of the Ensure Active Cart Exists process flow.  When an anonymous user converts to an authenticated user the global event AfterServicesLogon is fired.  An A synchronous event handler takes care of updating the cart associated with the current anonymous token to the newly authenticated user.  If the user already had an active cart associated with their web user id, that cart is moved to Saved status so the current shopping experience is preserved.