# AJAX API Docs

## Cart

{% embed url="<https://shopify.dev/api/ajax/reference/cart#add-a-selling-plan>" %}

### URL parameter version

`%26` = `&` needs to be used after `return_to`

#### Add single item&#x20;

`/cart/add?items[][id]=39967458000981&items[][quantity]=1&items[][selling_plan]=3766747221`

#### Clear cart -> add a single item

`/cart/clear?return_to=/cart/add?items[][id]=39967458000981%26items[][quantity]=1%26items[][selling_plan]=3766747221`

#### Clear cart -> add a single item -> go to checkout

`/cart/clear?return_to=/cart/add?items[][id]=39967458000981%26items[][quantity]=1%26items[][selling_plan]=3766747221%26return_to=/checkout`

#### Add multiple items

`/cart/add?items[0][id]=39967458000981&items[0][quantity]=1&items[0][selling_plan]=3766747221&items[1][id]=40066668691541&items[1][quantity]=1&items[1][selling_plan]=4186832981`

#### Clear cart -> add multiple items

`/cart/clear?return_to=/cart/add?items[0][id]=39967458000981%26items[0][quantity]=1%26items[0][selling_plan]=3766747221%26items[1][id]=40066668691541%26items[1][quantity]=1%26items[1][selling_plan]=4186832981`

#### Clear cart -> add multiple items -> go to checkout

`/cart/clear?return_to=/cart/add?items[0][id]=39967458000981%26items[0][quantity]=1%26items[0][selling_plan]=3766747221%26items[1][id]=40066668691541%26items[1][quantity]=1%26items[1][selling_plan]=4186832981%26return_to=/checkout`

## Product

{% embed url="<https://shopify.dev/api/ajax/reference/product#selling-plan-example>" %}
