Skip to main content
This feature is not part of the REST API. Do not treat it as such!
This feature is designed to transfer the cart over to the web version of your store. It allows the guest customer to continue shopping or checkout what they already have in the cart added via your headless application. It’s handy if you have not yet worked with payment gateway like Stripe to handle the headless checkout. You can choose to override the cart (if anything is set) or merge the cart items together.
If a customer is logged in via the web version of your store then WooCommerce will then merge any items in the cart together with the items the guest customer has in cart.
FYI: It does not matter if your customer is logged in or not already via the web version of your store. Only the cart data will be set. Customer details are not transferred.

Query properties

QueryTypeDescription
cocart-load-cartstringSet the cart key of the cart you wish to load. mandatory
notifyboolSet as true to notify customers once arrived on the web version of your store. Default is false
keep-cartboolSet as false to merge cart data. Default is true
To load the cart from session on your web store, you must use the properties above to query your website. You can query any page you prefer your customer to land on as the cart is loaded in the background. https://example-store.com/checkout/?cocart-load-cart=bbfa8e97ac9cff4c861d62a109e83bb6
If the same item already exists in cart and you are merging the two carts together, that item will not change. It will not increase or decrease the quantity if the cart item key are the same.

FAQ

Use the notice property to try loading the cart session again. This can be used also to debug why but normally this is because of two things.
  1. The cart key was incorrect
  2. The cart session has expired and is no longer in the database under that cart key.
Use this filter to change the name.
<?php
add_filter( 'cocart_load_cart_query_name', function() {
    return 'redpill'; // All im offering is the truth nothing more.
});
If you do not need or want to use WooCommerce native checkout then disable using this filter.
<?php
add_filter( 'cocart_disable_load_cart', function() {
    return true;
});
I