# Sending shopping cart events using library

**Update Cart**

Workflow start when **Update Cart** event happens. This event can be triggered when the subscriber adds the product to the cart or visits products. Then the workflow will wait a specific period of time before sent.

```markup
<script>
    sarepush('updateCart', {}, function (response) {
        console.log(response);
    });
</script>
```

Additionally you can enrich the event with product data that can be used to personalize the message.&#x20;

```markup
<script>
    sarepush('updateCart', {
        product_id: 99
        product_price: "23$"
        product_name: "Green t-shirt"
    }, function (response) {
        console.log(response);
    });
</script>
```

**Complete Cart**

You can stop the workflow by send **Complete Cart** event. Should be done when the subscriber buys products.

```markup
<script>
    sarepush('completeCart', {}, function (response) {
        console.log(response);
    });
</script>.
```

{% content-ref url="/pages/-Lm4fenR-D8kfHmPdjgq" %}
[Message personalization](/campaigns/personalization.md)
{% endcontent-ref %}


---

# 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://push-help.sare.pl/installation/sending-shopping-cart-events-using-library.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.
