> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.poptin.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to add an item to your WooCommerce store's cart via poptin?


1. Go to the design page of your poptin

2. Add an HTML element from the side menu:

![](https://storage.crisp.chat/users/helpdesk/website/7a34af3b43dae400/image_unmdi7.png)

3. Add this code inside:

```javascript
<script> $(".poptin-form-submit-button").on("click",function(){
$.get('/?post_type=product&add-to-cart=126', function() { window.location.href='https://yourdomain.com/cart'; });
});
</script>
```

Don't forget to change the **Product ID** and the **Domain**

**Note**: If you have a paid plan and want to include **Dropdown fields** in your popup so the visitor will be able to choose a specific color, size etc then use this code:

![](https://storage.crisp.chat/users/helpdesk/website/7a34af3b43dae400/image_1mu0489.png)

```javascript
<script>
$("#poptinFormSubmitButton").on("click",function(){ var pop_attr1=$('.poptin-design-fields-form[data-placeholder="Color"] option:selected').attr("value"); var pop_attr2=$('.poptin-design-fields-form[data-placeholder="Size"] option:selected').attr("value");
$.get('/?post_type=product&add-to-cart=126&attribute_pa_color='+pop_attr1+'&attribute_pa_size='+pop_attr2, function () {
window.location.href = 'https://yourdomain.com/cart'; });
});
</script>
```

Don't forget to change the **Product ID, Domain, the exact Placeholders and the Attributes**.

This is how you can the Attributes in your WordPress Admin panel: Woocommerce: Products > Attributes

![](https://storage.crisp.chat/users/helpdesk/website/7a34af3b43dae400/image_1lbd76o.png)

and the **Placeholders** for your popup:

![](https://storage.crisp.chat/users/helpdesk/website/7a34af3b43dae400/image_1bge9p9.png)

4. You can choose to Close the popup right after the click, or redirect the the Cart page (or any other page). If you want to redirect to a different page, please **use the Thank-you screen option and add 1 second delay**. You can find those option under the General Settings. You can write on the thank you screen something like "The product is added to your cart".

![](https://storage.crisp.chat/users/helpdesk/website/7a34af3b43dae400/image_1mqrvrl.png)

**Note**: After the visitors click on the "Add to cart" button, they will be redirects to your Cart page.