Cart REST API for WooCommerce — CoCart Lite


CoCart: The #1 REST API that handles the frontend of WooCommerce.

CoCart handles the shopping cart in any modern framework of your choosing. No local storing required. Powerful and developer friendly ready to build your headless store, without building an API.

Why should I use CoCart?

The question is why not! WooCommerce’s REST API is only created for store managers to control the backend of your store. So it’s not the API you need to allow your customers to shop.

If you are wanting to build a headless WooCommerce store then CoCart is your solution.

With the documentation provided, you’ll learn how to enable the ability to add products to a cart and allow your customers to manage it in no time.

Testimonials — Developers love it

CoCart, in my opinion, is the best frontend REST API for WooCommerce. Don’t just take my word for it though:

Amazing Plugin. I’m using it to create a react-native app with WooCommerce as back-end. This plugin is a life-saver! Daniel Loureiro

This plugin saved me tones of work and it is working amazingly! The plugin author provides fast and high quality support. Well done! @codenroll

Thanks for doing such a great work with this! Works exactly as expected and CoCart seems to have a nice community around it. The founder seems really devoted and that’s one of the key things for a plugin like this to live on and get the right updates in the future. We just got ourselves the lifetime subscription. Mighty Group Agency

This plugin works great out of the box for adding products to the Woo cart via API. The code is solid and functionality is as expected, thanks Sebastien! Scott Bolinger, Creator of Holler Box


CoCart Lite provides the basic features to get you started.

  • Add simple and variable products to the cart.
  • Update items in the cart.
  • Remove items from the cart.
  • Restore items to the cart.
  • Calculate the totals.
  • Retrieve the cart totals.
  • View the carts contents.
  • Retrieve the item count.
  • Empty the cart.
  • Logout customer.
  • Supports guest customers.
  • Supports basic authentication without the need to cookie authenticate.
  • Supports authentication via WooCommerce’s method.

Included with these features are filters and action hooks for developers.

  • CoCart Product Support Boilerplate provides a basic boilerplate for supporting a different product type to add to the cart with validation including adding your own parameters.
  • CoCart Tweaks provides a starting point for developers to tweak CoCart to their needs.
  • CoCart Beta Tester allows you to test with bleeding edge versions of CoCart from the GitHub repo.

CoCart Pro

CoCart Lite is just the tip of the iceberg. CoCart Pro completes it with the following features:

  • Plugin Updates for 1 year.
  • Priority Support for CoCart Pro users via Slack.
  • Add and Remove Coupons to Cart
  • Retrieve Applied Coupons
  • Retrieve Coupon Discount Total
  • Retrieve Cart Total Weight
  • Retrieve Cross Sells
  • Retrieve and Set Payment Method
  • Retrieve and Set Shipping Methods
  • Retrieve and Set Fees
  • Calculate Shipping Fees
  • Calculate Totals and Fees
  • Coming Soon Remove All Coupons from Cart
  • Coming Soon Register Customers
  • Coming Soon Retrieve Checkout Fields
  • Coming Soon Set Cart Customer (In Development)
  • Coming Soon Create Order (In Development)
  • Coming Soon Return Customers Orders
  • Coming Soon Return Customers Subscriptions
  • Coming Soon Return Customers Downloads (Auditing)
  • Coming Soon Return Customers Payment Methods (Auditing)
  • Coming Soon Get and Update Customers Profile (In Development)

Buy CoCart Pro Now

Extensions supported

View list of the WooCommerce extensions that support CoCart or are supported in CoCart Pro.

Priority support

I aim to provide regular support for the CoCart plugin on the forums. But please understand that I do prioritize support. Communication is handled privately via direct messaging in Slack and is available to people who bought CoCart Pro or paid for the 14 day priority support.

Add-ons to further enhance your cart.

We also have add-ons that extend CoCart to enhance your development and your customers shopping experience.

  • Get Cart Enhanced enhances the cart response returned with the cart totals, coupons applied, additional product details and more. — FREE
  • Products provides a public and better version of WooCommerce REST API for accessing products, categories, tags, attributes and even reviews without the need to authenticate.
  • Advanced Custom Fields extends CoCart Products add-on by returning all your advanced custom fields for products. — REQUIRES COCART PRODUCTS
  • Yoast SEO extends CoCart Products add-on by returning Yoast SEO data for products, product categories and product tags. — REQUIRES COCART PRODUCTS
  • and more add-ons in development.

They work with the FREE version of CoCart already, and these add-ons of course come with support too.

Join our growing community

A Slack community for developers, WordPress agencies and shop owners building the fastest and best headless WooCommerce stores with CoCart.

Join our community

Built with developers in mind

Extensible, adaptable, and open source — CoCart is created with developers in mind. If you’re interested to jump in the project, there are opportunities for developers at all levels to get involved. Contribute to CoCart on the GitHub repository and join the party.

Check out open issues and join the #core channel on Slack. If you don’t have a Slack account yet, you can sign up at

Bug reports

Bug reports for CoCart are welcomed in the CoCart repository on GitHub. Please note that GitHub is not a support forum, and that issues that aren’t properly qualified as bugs will be closed.

More information


This plugin is created by Sébastien Dumont.

Contributors & Developers

«CoCart Lite» has not yet been translated in other languages. You can translate «CoCart Lite» into your language.


Browse the code, check out the SVN repository, or subscribe to the development log by RSS.


  • Empty Cart
  • Cart with Item


Minimum Requirements

Visit the WooCommerce server requirements documentation for a detailed list of server requirements.

Automatic installation

Automatic installation is the easiest option as WordPress handles the file transfers itself and you don’t need to leave your web browser. To do an automatic install of CoCart, log in to your WordPress dashboard, navigate to the Plugins menu and click Add New.

In the search field type «CoCart» and click Search Plugins. Once you’ve found the plugin you can view details about it such as the point release, rating and description. Most importantly of course, you can install it by simply clicking «Install Now».

Manual installation

The manual installation method involves downloading the plugin and uploading it to your webserver via your favourite FTP application. The WordPress codex contains instructions on how to do this here.


Automatic updates should work like a charm; as always though, ensure you backup your site just in case.

Часто задаваемые вопросы

Is CoCart free?

Yes! CoCart’s core features are absolutely free. CoCart Pro completes the full cart experience!

How do I start using CoCart?

You will first need WooCommerce v3.6 or higher installed with the REST API enabled. Then install CoCart and follow the documentation. That’s it!

Why should I use CoCart?

The question is why not! WooCommerce’s REST API is only created for controlling the backend of your store. Not the API your needing for your customers who only see the frontend.

If you are wanting to build a headless WooCommerce store then CoCart is your solution.

Who should use CoCart?

CoCart is perfect for store owners and developers. If you want to create an e-commerce app for mobile or a custom frontend shopping experience completely using the REST API, then you need to use CoCart.

Do I need to have coding skills to use CoCart?

As this plugin is built for developers, you will need to have some coding knowledge to use it. Checkout the documentation to get some understanding.

Where can I find documentation for CoCart?

You can find the documentation for CoCart on the CoCart REST API Docs.

Can I change the layout format/add/change details to the responses?

You certainly can. Filters are available to do just that. Checkout the tweaks plugin to view or maybe use the examples provided. View the documentation for more.

Where can I report bugs?

Report bugs on the CoCart GitHub repository. You can also notify us via the support forum – be sure to search the forums to confirm that the error has not already been reported.

CoCart is awesome! Can I contribute?

Yes, you can! Join in on our GitHub repository and follow the development blog to stay up-to-date with everything happening in the project.

Is CoCart translatable?

Yes! CoCart is deployed with full translation and localization support via the ‘cart-rest-api-for-woocommerce’ text-domain.

Where can I get help or talk other users about CoCart core?

If you get stuck, you can ask for help in the CoCart support forum or join the CoCart Community on Slack where you will find like minded developers who help each other out. If you are in need of priority support, it will be provided by either purchasing CoCart Pro or the 14 day priority support.

Where can I find out about the pricing of CoCart Pro?

Find out all relevant pricing information over on the official site.

My question is not listed here. Where can I find more answers?

Check out Frequently Asked Questions for more.


Посмотреть все 15 отзывов

Участники и разработчики

«Cart REST API for WooCommerce — CoCart Lite» — проект с открытым исходным кодом. В развитие плагина внесли свой вклад следующие участники:


Журнал изменений

v2.7.4 — 18th November, 2020

  • Enhanced: 🤯 Access-Control-Expose-Headers to allow X-COCART-API to be exposed allowing frameworks like React to fetch them.
  • Tested: ✔️ Compatible with WooCommerce v4.7

This is a community release by @saulable

v2.7.3 — 8th November, 2020

🔥 This is a HOTFIX!

  • Fixed: Warning of missing domain key from setcookie() options. Thanks to @pauld8
  • Fixed: Carts already in session still updates even if the cart is now empty.

v2.7.2 — 8th November, 2020

  • Changed: Default expiration length for a cart to expire. Previously 30 days, now only 7 days.
  • Enhanced: Use first gallery image for thumbnail if featured image is not set.
  • Enhanced: Added back the use of httponly when setting cocart_setcookie for the frontend. Defaults: true for frontend, false via REST API.
  • Enhanced: Prevents variations that are not purchasable from passing validation when added to the cart should the variation ID not be set.
  • Fixed: Logger was not passing the full log entry just the message.
  • Improved: Variation ID now returns in cart response based on variation attributes if not set.
  • Improved: Saving carts for guest customers in the database no longer creates additional empty carts. Only 1 cart per customer. 😄🎉
  • Improved: WooCommerce System Status to show how many carts are going to expire soon and out of how many in session. ✅
  • Dev: Deprecated filter cocart_empty_cart_expiration. Not needed any more.
  • Dev: Info log for user switch no longer records if a user ID is not set.
  • Dev: New filter cocart_is_cart_data_valid let’s you validate the cart data before a cart is saved in session.
  • Dev: New filter cocart_set_cookie_options allows you to filter the cookie flags, which enables setting of samesite. 🏁 — Only for those who use PHP 7.3 or above.
  • Dev: New filter cocart_cookie_httponly on the httponly param on cocart_setcookie() with all the function parameters passed through.

Certain links that take you to «» or «» now contain basic site info. This includes the following: PHP Version, WordPress Version, WooCommerce Version, CoCart Version, Days plugin active, debug mode, memory limit, user language, multisite and environment type.

v2.7.1 — 30th October, 2020

🔥 This is a HOTFIX!

  • Fixed: Incorrect validation for variation and cart_item_data fields when adding a product to the cart.

v2.7.0 — 27th October, 2020

  • NEW — Added the cart key via the headers. Look for X-CoCart-API
  • Enhanced: Variable validation by removing parameters not used.
  • Enhanced: REST API parameters sanitized and validated.
  • Fixed: Undefined class constant E_WC_ADMIN_NOTE_MARKETING for those who are using WooCommerce lower than version 4.3.0. Thanks to @dmchale
  • Fixed: If stock not available when updating item, return error. Thanks to @pauld8
  • Fixed: Product ID validation should the ID not be present. Also returns correct product ID should SKU ID be used instead.
  • Tested: Compatible with WooCommerce v4.6.0
  • Dev: New filter cocart_is_rest_api_request to allow developers run their own API check-up.
  • Dev: New filter cocart_return_default_response that if set to false will allow you to return a completely new filtered response using cocart_****_response. You replace **** with the API route e.g: cocart_cart_response or cart_add_item_response.

New response has been applied to all API routes excluding the following: logout, count-items, totals.
Plugin name has been renamed from «CoCart» to «CoCart Lite».

View the full changelog here.