How to retrieve cart data as json in woocommerce - php

I am trying to build a cart inside angular. What I want is to retrieve the cart items from woocommerce as json so I can use it in the angular framework. I have search the woocommerce api documentation but couldn't find anything about cart data.

As per their documentation at the following address:
http://woothemes.github.io/woocommerce-rest-api-docs/
I believe the part you will want will be under "Orders". The list of properties are there.

Related

Gravity Forms attach cart item attributes programmatically

It's quite the complicated issue, so let me dissect it into steps:
1) We're sending cart data (including Gravity Form attributes) from WEBSITE_A (source) to WEBSITE_B (target) using the WP REST API.
2) Cart data is sent from WEBSITE_A and received on WEBSITE_B successfully. The data is received on WEBSITE_B as a JSON object: https://jsonblob.com/83fac8e3-48c1-11ea-b41a-4f98a26d7b37
3) Products on both WEBSITE_A and WEBSITE_B are identical but, obviously, each product's ID is different. Therefore, we add products to the user's cart by matching on sku, the sku can be found in the above JSON Blob link.
4) However, something similar needs to be done to attach the "gravity_form_attributes" (in the JSON object) to the Gravity Form forms of the corresponding products. The product forms on WEBSITE_A and WEBSITE_B are NOT identical, so we'll need to find a way to populate a product's form attributes with data from above JSON object.
Is there any way to achieve this? The Gravity Forms documentation doesn't help either and their support told me to hire an external developer.

Woocommerce Manually Add Order: How to filter products in ajax call

Objective: To filter or modify results fetched through woocommerce_json_search_products_and_variations
I am trying to filter products that are fetched through ajax calls on site-url-/wp-admin/post-new.php?post_type=shop_order (Manual Order addition in woocommerce)
It hits the URL site-url/wp-admin/admin-ajax.php?term=test&action=woocommerce_json_search_products_and_variations&security=xxxxx
I am not able to find proper woocommmerce hook/filter to modify this.
Please suggest. I can code from there.
Screen where the product ajax call is made.
You can filter the results using the below:
add_filter('woocommerce_json_search_found_products','filter_product_search',10,1);
You are passed a key/value array of the product results and the key being product ID if you need to look up the product to get additional info.

Magento API list only one column for example SKU from Products

How to use Magento API function (catalog_product.list) to get list of product but I don't want to get ALL data of product from magento (i want to get in response from Magento API only ONE column - attribute - list of product IDs only or better attribute). Is it possible to filter response? I need this to decrease connection transfer usage.. if its impossible how can I solve this problem?
Regards

Magento RESTful API for adding product to cart

Is there any RESTful API to add product to cart in Magento? I know it can be done using SOAP/XML but I am looking for solution using RESTful/JSON.
Thanks in advance
2015 - If you are looking for an answer like me, with Magento 2.0 this is now possible.
http://devdocs.magento.com/swagger/index.html
POST /V1/carts/{cartId}/items
Look for quoteCartItemRepositoryV1. There is a post method to add product to the cart.
right now we can just view the information using RESTful API like retrieve the inventory, orders, products, customers list and information.
Yes, you can extend the functionality of the api to add product to cart.

How to link into a cart outside of magento that was built with the cart api's

I am building a custom front end to Magento, where users selects the products they want to purchase outside of Magento. But then use Magento for the rest.
I already use the product api's to pull the product_id/sku/name/price out. So I have a list of product_id’s ready for purchase.
I will use the api's for creating and building a shopping cart.
My question is…
Once I populate a shopping cart using the apis and have the shoppingcart_id, how do I redirect the user directly into that shopping cart page in Magento?
Thanks for any help or suggestions.
Redirecting is easy. This is how you can do it in Magento 1.5. Note that you need to be running within a controller action in order for this to work properly.
$this->_redirect('checkout/cart');
If you want to direct the user to the checkout page, try something like the following:
$this->_redirect('checkout/onepage/');
Hope this helps!

Categories