Title: Push Location using REST Api
Last modified: June 17, 2020

---

# Push Location using REST Api

 *  Resolved [tahafarooqui](https://wordpress.org/support/users/tahafarooqui/)
 * (@tahafarooqui)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/push-location-using-rest-api/)
 * How to push Location and stock using wordpress REST Api

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Contributor [alexmigf](https://wordpress.org/support/users/alexmigf/)
 * (@alexmigf)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/push-location-using-rest-api/#post-13000800)
 * Hello [@tahafarooqui](https://wordpress.org/support/users/tahafarooqui/)
 * The plugin delivers two endpoints:
 *     ```
       /wp-json/wc/v3/products/id
       /wp-json/wc/v3/products/id/variations/id (first ID is for parent product, the second one for the variation ID)
       ```
   
 * Both accept `GET` and `UPDATE` requests.
 *  [jboyoli](https://wordpress.org/support/users/jboyoli/)
 * (@jboyoli)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/push-location-using-rest-api/#post-13044253)
 * HI, I was using a very basic plugin in php to update my products stock qty from
   an external XML feed and used
 *     ```
       $woocmmerce_instance = wc_get_product( $prodID );
       $new_quantity=wc_update_product_stock( $woocmmerce_instance, $quantity);
       ```
   
 * So now I wanted to use your Get and Update api methods but I’m not familiar on
   how to do it. Is there any example or any documentation on how I can replace 
   the above mentioned method and use yours to update the stock @ locations?
 * Also is there a way to programatically assign to my existing products the stock
   locations?
 * Thanks in advance!
 *  Plugin Contributor [alexmigf](https://wordpress.org/support/users/alexmigf/)
 * (@alexmigf)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/push-location-using-rest-api/#post-13050259)
 * Hello [@jboyoli](https://wordpress.org/support/users/jboyoli/)
 * You can read more about the WooCommerce REST API [here](https://docs.woocommerce.com/document/woocommerce-rest-api/)
   and [here](https://docs.woocommerce.com/document/woocommerce-rest-api/).
 * To assign locations programmatically you need to loop throw all products and 
   use `wp_set_object_terms( $post_id, array($location1_id, $location2_id), 'location');`
   inside the loop.
 *  [Merav](https://wordpress.org/support/users/meravwebs/)
 * (@meravwebs)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/push-location-using-rest-api/#post-13566980)
 * how can i update the product quantity using the rest API?
    meaning – how should
   the request look like? (assuming each product have multiple locatioons).
 * EDIT: managed to solve this issue.
    -  This reply was modified 5 years, 7 months ago by [Merav](https://wordpress.org/support/users/meravwebs/).
      Reason: solved

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Push Location using REST Api’ is closed to new replies.

 * ![](https://ps.w.org/stock-locations-for-woocommerce/assets/icon.svg?rev=2471943)
 * [Stock Locations for WooCommerce](https://wordpress.org/plugins/stock-locations-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/stock-locations-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/stock-locations-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/stock-locations-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/stock-locations-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/stock-locations-for-woocommerce/reviews/)

## Tags

 * [Woocommerce Stock](https://wordpress.org/support/topic-tag/woocommerce-stock/)

 * 4 replies
 * 4 participants
 * Last reply from: [Merav](https://wordpress.org/support/users/meravwebs/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/push-location-using-rest-api/#post-13566980)
 * Status: resolved