Woocommerce: Get Cart Count Total via Rest API

Created on 22 Jul 2017  路  1Comment  路  Source: woocommerce/woocommerce

Hi,

I checked the WooCommerce Rest API doc, unfortunately, didn't found any end point to get the "Cart Count Total".

So I create my custom end point and use WC()->cart->get_cart_contents_count() it always return 0. Even there are products in the cart.

Is there any way to get the cart total by using the Rest API ?

My WordPress is in a sub directory and I want to show the cart count total on the homepage.

>All comments

This is not possible - the REST API handles WooCommerce data, but not user sessions/carts. You'll need to create a custom endpoint to return this. It does not need to be via the REST API - it could be done in a plugin.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

5tormTrooper picture 5tormTrooper  路  3Comments

maxrice picture maxrice  路  3Comments

tushonline picture tushonline  路  3Comments

mikejolley picture mikejolley  路  3Comments

svenauhagen picture svenauhagen  路  3Comments