3D-Guided Service Instructions > 3D-Guided Service Instructions 303: Create a Persistent Shopping Cart Using ThingWorx > Import cartThing into ThingWorx Composer
  
Import cartThing into ThingWorx Composer
Similar to how you added the shoppingThing in 3D-Guided Service Instructions 302, you’ll add a new Thing named cartThing. cartThing consists of eight services:
addToCart
checkCart
clearCart
getCart
getCartTotal
getOrder
getOrders
orderCart
Each of these services serve as a different functionality, but all come together to create a persistent cart inside ThingWorx.
1. Download the metaShoppingEntities.twx file.
2. Follow the instructions for importing and exporting files into ThingWorx Composer.
3. Open cartThing once it has been imported into ThingWorx.
4. The General Information tab includes general information about the Thing. In this case, the Name, Description, Tags, and ThingTemplate for the Thing are included. Tags are used to group or categorize ThingWorx entities and ThingTemplates are used to create a new Thing based on a common base and functionality.
5. Under General Information, click Services to view all services associated with cartThing.
Service
Description
addToCart
The addToCart service works much like the addToCart function you created in Vuforia Studio. The addToCart service intakes the part number (pid), quantity (qty) and price (price) of the selected part. Using the input information, along with user information from ThingWorx, a user ID is created as a way of designating the person using the service. This user ID (uid) is a unique identifier for each order and is necessary for persistence because it differentiates a user and their individual sessions apart from others. When a part is added to the cart, its part information is stored inside an entry in a data table, which is then sent into the infotable used to store the cart.
getCart
Once a cart has been created, the getCart service is used to obtain the entries for the cart. It takes the information that was added to the cart and outputs it as an infotable. This will be used to update the cart when changes are made to it in the Vuforia Studio experience.
getCartTotal
The getCartTotal service works like getCart, except instead of returning an entire table of information, its only output is the total price of the items in the cart.
checkCart
When values are input into addToCart, there may be mistakes. For example, in the event of an incorrect price quote for a customer, the checkCart service is used to validate all product information that was input into addToCart. If any information is incorrect, checkCart will correct that information inside the cart.
clearCart
clearCart clears all items from the cart.
orderCart
When invoked, the orderCart service places an order for all the parts that are in the cart. Before the orderCart service completes, you are given the option of to validate the information in the cart using checkCart.
After the service is invoked, a transaction ID (tid) is created with the user’s name and order number, and the purchased property of the infotable is changed to true to signify that the part in the cart has been purchased.
getOrder
The getOrder service allows you to input a transaction ID (tid) and receive all the information about that specific order in a table.
getOrders
getOrders skips the tid input, and displays all orders that have been made from the cart in a table.
6. Under Permissions, click Run Time and make sure that both of your ThingWorx and Vuforia Studio instances have full access permissions for the cartThing. This will enable the service to be called in Vuforia Studio.
7. Next, you’ll add the cartThing to Vuforia Studio.