# Add a product to the cart in the frontend for cypress testing

**URL:** <https://forum.shopware.com/t/add-a-product-to-the-cart-in-the-frontend-for-cypress-testing/65486>\
**Category:** Programming (EN)\
**Created:** [13. März 2020 um 10:47 UTC](https://forum.shopware.com/t/add-a-product-to-the-cart-in-the-frontend-for-cypress-testing/65486 "2020-03-13T10:47:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pascal1988](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@Pascal1988](https://forum.shopware.com/u/Pascal1988)\
**Post date:** [13. März 2020 um 10:47 UTC](https://forum.shopware.com/t/add-a-product-to-the-cart-in-the-frontend-for-cypress-testing/65486/1 "2020-03-13T10:47:05Z")

</div>

As i’m writing some tests for the checkout (planning to make some adjustments there and it’s quite important i don’t wreck the checkout). I kinda want to add a product to the frontend cart in a before or beforeEach hook. and i’m not quite sure if fixtures are meant for this.

anybody here who can help give me a pointer in wich direction to look?

---

<div class="post-metadata">

**Author:** ![rschwering](https://avatars.discourse-cdn.com/v4/letter/r/cab0a1/32.png) [@rschwering](https://forum.shopware.com/u/rschwering)\
**Post date:** [17. April 2020 um 14:26 UTC](https://forum.shopware.com/t/add-a-product-to-the-cart-in-the-frontend-for-cypress-testing/65486/2 "2020-04-17T14:26:07Z")

</div>

Hello,

I’m not sure if you still need help here, but I’d like to give a starting point to you either way - At least for other people who are searching. Even if fixtures aren’t the right thing per definition, we can achieve this by using commands in a similar way I think - as we use the Shopware API to create test data =&nbsp; similar approach.

In our [order fixture](https://github.com/shopware/e2e-testsuite-platform/blob/2b1ee86044a0143d51bd155a48efcb1cdf584064/cypress/support/service/saleschannel/fixture/order.fixture.js#L4), we do a complete checkout API-wise which means we have to add products to the cart as interim stage. Maybe you can write an own command based on this fixture as a starting point.

Kind regards!

Ramona
