# Adding items to the shopping cart

The most straightforward implementation of a shopping cart involves the following steps:

1. Create a "Product" page that showcases a product and has an "Add to cart" button
2. Create a workflow on the "Add to cart" button that:
   * Creates a new "Cart Item"
   * Adds this "Cart Item" to the current user's shopping cart
     * I recommend putting on a conditional statement so that the workflow only runs when the current user is logged in

You can see an example of this in action in [my demo app](https://shopping-cart-demo-67649.bubbleapps.io/version-test/product/1688737812511x697129325935356800?debug_mode=true).

<figure><img src="/files/JbbMMxVbuNxveZ1tnIst" alt=""><figcaption><p>Example of Product Page</p></figcaption></figure>

You'll then need to create a "Checkout" page where the current user's cart items are listed. ([demo app example](https://shopping-cart-demo-67649.bubbleapps.io/version-test/checkout?debug_mode=true)).

<figure><img src="/files/Nd21hdrFxYzLiKT3veZ2" alt=""><figcaption><p>Example of Checkout Page</p></figcaption></figure>

In the above example I'm using a Repeating Group with the Type of contet set to "Cart Item" and the Data source to "Current User's shopping cart" (which is itself a list of cart items).

<figure><img src="/files/fXiQy9uQANFkKsrwNnqS" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cranford-tech.gitbook.io/stripe-checkout-shopping-cart-plugin/adding-items-to-the-shopping-cart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
