> For the complete documentation index, see [llms.txt](https://docs.zaui.com/zapi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zaui.com/zapi/zapi-calls/interacting-with-a-cart/add-product-to-cart.md).

# Add Product to Cart

## zapiAddProductToCart

<mark style="color:green;">`POST`</mark> `https://{yourdomainname}.zaui.net/zapi/`

#### Request Body

| Name                                            | Type    | Description                                                                                                  |
| ----------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| zapiToken<mark style="color:red;">\*</mark>     | integer | Token that must be used for a reseller to communicate with the supplier system.                              |
| methodName<mark style="color:red;">\*</mark>    | string  | The method being called.                                                                                     |
| zapiUserId<mark style="color:red;">\*</mark>    | integer | Generated by the supplier system when a new contact is created.                                              |
| zapiAccountId<mark style="color:red;">\*</mark> | integer | Generated by the supplier system.                                                                            |
| linkedPackageId                                 | integer | Optional parameters for linking a product to an individual package. Required for percentage-based products.  |
| productId<mark style="color:red;">\*</mark>     | integer | ID of the product.                                                                                           |
| cartId<mark style="color:red;">\*</mark>        | integer | ID of the current cart session to add the activity to.                                                       |
| linkedActivityId                                | integer | Optional parameters for linking a product to an individual activity. Required for percentage-based products. |
| quantity<mark style="color:red;">\*</mark>      | integer | How many of each product to add to the card                                                                  |

{% tabs %}
{% tab title="200: OK " %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<response>
    <zapiVersion>2.1</zapiVersion>
    <error>0</error>
    <message>OK</message>
    <methodResponse>
        <methodName>zapiAddProductToCart</methodName>
        <cart>
            <cartId>3b1fbe9bb6937d2932c8535217302be3</cartId>
            <customers/>
            <activities/>
            <products>
                <product>
                    <attributeId>33</attributeId>
                    <productType>
                        <![CDATA[Flat]]>
                    </productType>
                    <productId>6</productId>
                    <productClass>1</productClass>
                    <cartItemId>33</cartItemId>
                    <packageId>0</packageId>
                    <packageName/>
                    <productName>
                        <![CDATA[Ski Poles]]>
                    </productName>
                    <quantity>2.00</quantity>
                    <price>$5.00</price>
                    <total>$10.00</total>
                    <inventoryRemainsAvailable>true</inventoryRemainsAvailable>
                </product>
            </products>
            <remainingBalance>
                <balance>$10.50</balance>
            </remainingBalance>
            <cartTotals>
                <bookingNumber>0</bookingNumber>
                <modifyBookingNumber>0</modifyBookingNumber>
                <bookingSourcedOnline/>
                <activityTotal>$0.00</activityTotal>
                <activityTax>$0.00</activityTax>
                <productTotal>$10.00</productTotal>
                <productTax>$0.50</productTax>
                <packageTotal>$0.00</packageTotal>
                <activitySurplusFees>$0.00</activitySurplusFees>
                <guestFee>$0.00</guestFee>
                <surchargeTotal>$0.00</surchargeTotal>
                <perPersonTax>$0.00</perPersonTax>
                <total>$10.00</total>
                <tax>$0.50</tax>
                <taxUnrounded>$0.50</taxUnrounded>
                <totalIncludingTax>$10.50</totalIncludingTax>
                <totalNetAmount>$0.00</totalNetAmount>
                <zauiMerchantFee>$0.58</zauiMerchantFee>
                <packageTotal_formatted>$0.00</packageTotal_formatted>
                <activityTotal_formatted>$0.00</activityTotal_formatted>
                <productTotal_formatted>$10.00</productTotal_formatted>
                <subtotal_formatted>$10.00</subtotal_formatted>
                <tax_formatted>$0.50</tax_formatted>
                <totalIncludingTax_formatted>$10.50</totalIncludingTax_formatted>
                <totalNetAmount_formatted>$0.00</totalNetAmount_formatted>
                <taxes>
                    <tax>
                        <taxDisplayName>GST</taxDisplayName>
                        <taxAmount>0.5</taxAmount>
                        <taxAmount_formatted>$0.50</taxAmount_formatted>
                    </tax>
                </taxes>
            </cartTotals>
        </cart>
        <currencies/>
        <methodErrorCode>0</methodErrorCode>
        <methodErrorMessage>
            <![CDATA[Added 2]]>
        </methodErrorMessage>
    </methodResponse>
</response>
```

{% endtab %}
{% endtabs %}

For percentage-based products, linkage to a package or activity will be required. This will also automatically determine the product price when it’s a percentage.

{% tabs %}
{% tab title="Request" %}

```xml
<request>
	<zapiToken></zapiToken>
	<zapiAccountId></zapiAccountId>
	<zapiUserId></zapiUserId>
	<zapiMethod>
		<methodName>zapiAddProductToCart</methodName>
		<cartId></cartId>
		<productId></productId>
		<linkedPackageId></linkedPackageId>
		<linkedActivityId></linkedActivityId>
		<quantity></quantity>
	</zapiMethod>
</request>
```

{% endtab %}

{% tab title="Response" %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<response>
	<zapiVersion>2.0</zapiVersion>
	<error>0</error>
	<message>OK</message>
	<methodResponse>
		<methodName>zapiAddProductToCart</methodName>
		<methodErrorCode>0</methodErrorCode>
		<methodErrorMessage></methodErrorMessage>
		<cart></cart>
	</methodResponse>
</response>
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://docs.zaui.com/zapi/zapi-calls/interacting-with-a-cart/add-product-to-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.
