Cart REST API for WooCommerce – CoCart Lite

Descripción

Building a headless store with the current WooCommerce REST API is kind of great, except, it’s missing one side of a store. The front side. 👕

See when your building a headless store, you want the ability to display your products so your customers can add them to the cart, 🛒 without the authentication roadblocks. 🔓 No need to force customers to register first. 🖊

So when you request to show your products in your app. Look! Your products are showing! 😀

But when your building a headless store with WooCommerce’s REST API, your only options are for the backend, not the frontend. 😭

It’s hard to build a store that way.

Now there’s CoCart. With CoCart you can build your headless store with the right REST API, for the frontend.

So if you want to display products by a category, go ahead, you can do it. 👍 All requests can be made in any code language and everything is completely customizable from the parameters, filters and action hooks.

So now building a headless WooCommerce store really is possible, only a whole lot easier.

CoCart. The fastest and easiest way to building headless WooCommerce stores.

Features

  • Add products to the cart.
  • Update items in the cart.
  • Remove items from the cart.
  • Restore items to the cart.
  • Calculate the totals.
  • Get the cart totals.
  • View the cart contents.
  • Get the item count.
  • Empty the cart.
  • Supports authentication via WooCommerce’s method.

CoCart Pro

This plugin is just the tip of the iceberg. Want the full cart experience? CoCart Pro completes it by supporting the following features:

  • Add and Remove Coupons to Cart
  • Get Applied Coupons
  • Get Coupon Discount Total
  • Get Cart Total Weight
  • Get Cross Sells
  • Get and Set Payment Method
  • Get and Set Shipping Methods
  • Get and Set Fees
  • Calculate Shipping Fees
  • Calculate Totals and Fees

Buy CoCart Pro Now

Extensions supported

CoCart also works well with official WooCommerce extensions such as:

More extensions are supported in CoCart Pro:

Give CoCart a try.

Want to unlock more? Upgrade to the Pro version.

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 GitHub and join the party.

More information

Credits

This plugin is created by Sébastien Dumont.

Capturas

  • Empty Cart
  • Viewing the carts content without product thumbnail.
  • Viewing the carts content with product thumbnail.

Instalación

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.

Updating

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

Preguntas frecuentes

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!

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?

The documentation for CoCart can be found here.

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

You certainly can. Filters are available to do just that (so long as you are using version 2.0+). Checkout the tweaks plugin to view or maybe use the examples provided.

Does it work with any of the official WooCommerce libraries?

Only if you request your customers to be logged in first. This is because all the official libraries require authentication which the cart does not require.

Can I view any customers cart?

Yes but only those with administrator capabilities can and if persistent cart was left enabled. – See documentation for more information.

Are you a Mobile app developer? In preparation for CoCart v2.1.0, support for storing cart data will be introduced to make it easier to access specific carts created and your feedback is needed. Read this article for more details.

Where can I report bugs or contribute to the project?

Report bugs on the CoCart GitHub repository.

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 ask for help?

If you get stuck, you can ask for help in the CoCart support forum.

Reseñas

18 de abril de 2019
I used this plugin for a mobile app project I have been working on and first off the documentation was very easy to follow. I had no issues getting it working and it integrated with JWT Authentication out of the box. Unfortunately, Woocommerce 3.6 came out and pretty much broke the plugin due to how they were now implementing certain things. I posted on the forums and in a few hours I got a response from the author. He was very understanding and gave a suggestion on what to do for the time being until he implemented a fix. A few hours later, he released a pre-release update which fixed the issue. TL:DR; Great plugin, Great support and will highly recommend this plugin to anyone who needs to access Woocommerce cart through a rest API.
13 de noviembre de 2018
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!
23 de octubre de 2018
Very nice plugin. For fast development.
18 de julio de 2018
This plugin was critical to achieve my project of building a Headless / Decoupled WooCommerce store. I wanted to provide my clients with a CMS to manage their store, but wanted to build the front-end in React. I was able to fetch content over the WooCommerce REST API, but otherwise would not have been able to fetch the cart, and add & remove items if not for this plugin. Thank you very much Sébastien for sharing this extension, you've saved me a lot of time.
12 de junio de 2018
Thanks very much for developing and sharing this. It has greatly helped me in creating a 'universal' cart in a WooCommerce multi-site environment, where only one site is running the shop. Seems a few bugs here and there; doesn't seem to play so nice with WooCommerce API - PHP Client but mostly works perfectly. I think a great feature would be to create a route to retrieve 'cart notices'. So, for example, if a product gets sold out, I can check if there are any cart notices like 'x has been removed from your cart', and print those outside of the WooCommerce environment. (This might be better for the WC core rest API.) EDIT Unfortunately this plugin didn't seem to work for me in the end. It did not work for me on a clean wordpress/woocommerce install with the official WooCommerce rest API php wrapper library. Only a single cart was ever interacted with. https://github.com/seb86/cart-rest-api-for-woocommerce/issues/31 Trying to use curl and javascript didn't work either in a multisite environment because of the complexities of transmitting session/cookie data from a SSO multisite when using the api. I think ultimately the key to making this plugin work would be to pass a customer id in a authenticated api call so that the cart in question is not dependent on the complex browser cart session processes going on in native WC, which make a bulletproof cart rest api a complex thing to achieve.
Leer todas las 6 reseñas

Colaboradores y desarrolladores

«Cart REST API for WooCommerce – CoCart Lite» es un software de código abierto. Las siguientes personas han colaborado con este plugin.

Colaboradores

Registro de cambios

v2.0.6 – 1st October, 2019

  • Added: Link to translate CoCart on the plugin row.
  • Tweaked: Upgrade admin notice for next release.
  • Tweaked: URL to latest beta news under the plugin row.

v2.0.5 – 14th September, 2019

  • Added: Support for WooCommerce’s authentication method.

v2.0.4 – 26th August, 2019

  • Added: More FAQ’s to readme.txt file for the WordPress plugin directory.
  • Changed: Title of the plugin in readme.txt file to improve SEO Results.
  • Changed: Minimum WooCommerce version required and supported is v3.6.
  • Tweaked: Upgrade link now shows always once plugin is installed, not after 1 week.
  • Tweaked: Upgrade link colour changed from green to red to stand out more.

v2.0.3 – 19th August, 2019

  • Added: A notice under the plugin row providing information on future versions coming that require your feedback.
  • Tested: Compatible with WooCommerce v3.7
  • Tweaked: Admin body class for CoCart page.
  • Updated: Documentation URL has changed to https://docs.cocart.xyz

v2.0.2 – 19th July, 2019

  • Tweaked: Updated link to getting started page if CoCart was installed via WP-CLI.

v2.0.1 – 18th July, 2019

  • Tweaked: get_cart_contents_count() is now called static.
  • Tweaked: Added check for cart totals to make sure they are set before falling back to cart totals in session.
  • Dev: Added filter cocart_update_item for the response when updating an item.
  • Dev: Tweaked CoCart page in the WordPress dashboard to support sections.

v2.0.0 – 3rd July, 2019

  • NEW: REST API namespace. CoCart is now an individual API and is no longer nested with WooCommerce’s core REST API.
  • NEW: Check to see if the cart is set before falling back to the cart in session if one exists.
  • NEW: Get a specific customers cart via their customer ID number. – See documentation for details.
  • NEW: Product title also returns besides just the product name when getting the cart.
  • NEW: Product price also returns when getting the cart.
  • Changed: Filter and Action Hook names in new API. – See documentation for details.
  • Improved: Complexity of functions for better performance and usage.
  • Tweaked: Added checking for items already in the cart.
  • Tweaked: Check if cart is empty before removing an item.
  • Tweaked: Responses for adding, updating, removing and restoring items to return whole cart if requested.
  • Tweaked: Responses for updating items to return the quantity of item along with message.
  • Tweaked: Totals can now return once calculated if requested.
  • Tweaked: Totals now return from session and can be returned pre-formatted if requested. – See documentation for details.
  • Tweaked: New option to refresh cart totals once item has been added or updated.
  • Dev: Added action hooks for getting cart, cart is cleared, item added, item removed and item restored.
  • Dev: Added filter to allow additional checks before the item is added to the cart.
  • Dev: Added filter to apply additional data to return when cart is returned.
  • Dev: Added filter to change the size of the thumbnail returned.
  • Dev: Added new option to return cart raw if requested.

View the full changelog here.