woocommerce-rest-api

Trigger Woocommerce outgoing email based on an order note

时光毁灭记忆、已成空白 提交于 2021-02-07 09:49:51
问题 Is it possible to trigger an outgoing email based on an added order note within WooCommerce? We've integrated with a stock control system (Mintsoft) who basically send us back the tracking ID via order notes (all linked up via the REST API) I've managed to hook into the content of the note based on the text inside, as the order object contains pretty much everything you could want - however it's out of scope at the point the usual "completed" mail goes out, meaning a template change is out of

Push XML DATA to REST API with PHP/cURL/JSON

微笑、不失礼 提交于 2021-01-29 08:08:32
问题 I'm somewhat stuck on a problem. I'm attempting to write an app that bascially reads and sorts DATA from an online XML file containing customers and recreates those customers in Wordpress/woocommerce through cURL/php/JSON. Im using insomnia to test my calls and code pieces. This is what i got so far: Pull customer data from the online database into xml [ but its raw unsorted and too much info ] Create a customer in Woocommerce/ Wordpress by POST request in JSON/PHP/cURL Im currently missing

How to display data from Woocomerce Api call?

谁说我不能喝 提交于 2021-01-28 21:21:36
问题 I have UWP app which downloads data from woocomerce. RestAPI rest = new RestAPI("http://simplegames.com.ua/wp-json/wc/v1/", "ck_9d64c027d2c5f81b8bed3342eeccc6d337be813d", "cs_60697b1e6cbdeb8d62d19e0765e339f8e3334754"); WCObject wc = new WCObject(rest); //Get all products var products = await wc.GetOrders(); Debug.WriteLine(products); I try to display data to Console. Debug shows name of method, how I can show data that I downloaded? 回答1: So, let's start //Get all products var products = await

WooCommerce API doesn't create product with SKU

眉间皱痕 提交于 2021-01-27 14:32:31
问题 I have this code that creates a new product in WooCommerce: $woocommerce = new Client( 'http://www.xxxx.com.br', 'ck_xxxxxx', 'cs_xxxxxx', [ 'wp_api' => true, // Enable the WP REST API integration 'version' => 'wc/v1' // WooCommerce WP REST API version ] ); $data = [ 'name' => 'Premium Quality', 'type' => 'variable', 'sku' => '123450000', ]; print_r($woocommerce->post('products', $data)); The product is inserted into the database with the name Premium Quality , the problem is that the SKU is

WooCommerce REST API GET multiple products by ID

故事扮演 提交于 2021-01-27 05:40:18
问题 I need to display all related products by eah product I have in my list. Eg, In my app I have 3 products with id 1, 2, 3 product id 1 has 5,6,7 as related, product id 2 with related 8 and 9 etc.. Now I have an array with all the related [5,6,7,8,9..] How can I get only this ones from REST API? I can call by single ID like that site.com/wp-json/wc/v2/products/5/ But doesn't work with multiple IDs like ../products/5/6/ or ../products/5,6/ Is this possible? 回答1: you could use parameter 'include'

WooCommerce REST API GET multiple products by ID

僤鯓⒐⒋嵵緔 提交于 2021-01-27 05:39:39
问题 I need to display all related products by eah product I have in my list. Eg, In my app I have 3 products with id 1, 2, 3 product id 1 has 5,6,7 as related, product id 2 with related 8 and 9 etc.. Now I have an array with all the related [5,6,7,8,9..] How can I get only this ones from REST API? I can call by single ID like that site.com/wp-json/wc/v2/products/5/ But doesn't work with multiple IDs like ../products/5/6/ or ../products/5,6/ Is this possible? 回答1: you could use parameter 'include'

WooCommerce REST API : query products by multiple attributes

喜夏-厌秋 提交于 2020-08-05 09:46:11
问题 According to the API : http://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-products we can filter products by a single attribute. But Is it impossible to search by multiple attributes through API ? Example : "I want red shirts". Here attribute is color and attribute term is red . To accomplish the search, the query string goes like this : products?category=17&attribute=pa_color&attribute_term=22& And we get the red shirts only. But for "I want red medium shirts" , here an

Rest API to store products in cart based on the user id in woocommerce

风流意气都作罢 提交于 2020-06-09 05:14:05
问题 Only related reference for the same I found with accepted by few people is the below mentioned code but there is no session stored in options table with the following key '_wc_session_'.$user_id function add_products_programmatically($user_id) { // Get the current session data and saved cart $wc_session_data = get_option('_wc_session_'.$user_id); // Get the persistent cart $full_user_meta = get_user_meta($user_id,'_woocommerce_persistent_cart', true); // Create a new WC_Cart instance and add

Get user meta data from woocommerce_created_customer hook in Woocommerce

*爱你&永不变心* 提交于 2020-04-13 07:12:27
问题 I am using woocommerce API to create a customer API is working fine and the new customer is creating fine into WP. But the issue is when I am using a hook "woocommerce_created_customer" I am not able to get user meta data like "first name", "last name" etc Here is a part of my code: ``` $this->loader->add_action( 'woocommerce_created_customer', $plugin_admin, 'add_user_to_zendesk', 50 ); public function add_user_to_zendesk( $user_id ) { if ( isset( $user_id ) && ! empty( $user_id ) ) { $user