Updating Product Stock Programmatically
Since I’ve been working a lot lately with synchronising product stock quantities between multiple WooCommerce stores or within a WordPress Multisite network, I can share with you some interesting insights how it is working.
Get Product Stock Quantity
In this tutorial I will not only show you how to get stock quantity in WooCommerce (of a product or a product variation by the way) but we will also display it on the shop page. Like this:
WooCommerce API – Product Sync with Multiple Stores
First of all we have to decide what is actually a product synchronisation? Let’s consider two scenarios here.
- Update a product with the same SKU on other WooCommerce stores automatically when it was updated by an administrator on the “Main store”. Here you can decide whether you would like to update a specific product data or all product data. And it is what we are going to do in this tutorial with code or with a plugin.
- Update product stock status and quantity on other WooCommerce stores not only when this product was updated by an administrator but also when the product was purchased (and its quantity was descreased, obviously). We are going to talk a little bit about it in this tutorial as well, but I recommend you to take a look at my another plugin which is intended to help you with that.
Bulk Copy and Update Products between WooCommerce Stores
Just another tutorial by your requests guys.
In this one we are about to create a bulk action like on the screenshot below which allows to sync products between two (or multiple) WooCommerce stores.
Create a Post on WordPress.com Site using REST API
I already have a lot of tutorials about working with REST API on regular WordPress websites, but recently I have updated my Simple WordPress Crossposting plugin to make it compatible with websites hosted on wordpress.com as well.
Unexpectedly there is a huge difference between wordpress.org and wordpress.com APIs, so here is the tutorial where we are about to dive into the example of how create a post with a featured image.
Get Post with Featured Image URL in REST API
I noticed that when people read my post about uploading a featured image via WordPress REST API, they are also searching how to get a post with its featured image URL.
So I decided to say a couple words about it.