JSON response of View Cart Contents
-
I get the cart content using nodeJs:
WooCommerce.get('cart', function(err, data, res) { console.log(JSON.parse(res)); });
But the output is for example:
2afc4dfb14e55c6face649a1d0c1025b : data : {} data_hash : "b5c1d5ca8bae6d4896cf1807cdf763f0" key : "2afc4dfb14e55c6face649a1d0c1025b" line_subtotal : 300 line_subtotal_tax : 30 line_tax : 30 line_tax_data : {subtotal: {…}, total: {…}} line_total : 300 product_id : 5434 product_name : "??????? ??? ???????? ?????" quantity : 1 variation : [] variation_id : 0 __proto__ : Object
I have to put key after JSON.parse(res) like this to access the cart data within an array: JSON.parse(res).2afc4dfb14e55c6face649a1d0c1025b
And because of “key” in front of cart items, I can not deal with cart.
When I don’t have the key of cart item, how can I access the cart data and containing products?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘JSON response of View Cart Contents’ is closed to new replies.