WooCommerce REST API: Create Product with Images

I am starting to have more and more tutorials about REST API on my blog which is for sure because I am doing some work with my crossposting plugin.

Today is another one where I am going to share with you a simple code example how you can add Product image and Product gallery images when creating a product with REST API.

Just in case I mean these things:

WooCommerce product image and gallery images
You can find this if you go and edit any WooCommerce product.

Sync Users Between Sites

In this post we are going to talk about REST API, particularly about how to sync user registrations, profile updates and removals between two completely separate WordPress websites.

If you need to sync posts instead, then I can suggest you a tutorial and a plugin.

How to Add Meta Fields when Creating a Post with REST API

This tutorial is a small addition to my another tutorial about creating posts with REST API in WordPress, because there I didn’t mention how to work with metadata and what moments you have to keep in mind.

As a result of this tutorial we will just create a simple draft post with a couple custom fields in it.

Upload Featured Image to a Post with REST API

Recently I have updated the tutorial about creating a post with WordPress REST API but I didn’t cover a topic of featured images there.

It is not that simple actually, but I will make it simple for you.

WooCommerce REST API: Create Products with Attributes

Before all I also recommend you to check my basic WooCommerce REST API tutorial, where we just created and updated some simple products.

Right now I am going to show you two more specific examples. Two – because there are two types of attributes in WooCommerce – custom attributes and the ones that created in Products > Attributes menu (those are technically taxonomies).

Create and Update Products with WooCommerce API

Recently I was publishing and updating the tutorials about WordPress REST API, how to create a post, how to add a featured image and so on. But did you know that WooCommerce has its own API which is build on the base of a regular WordPress REST API but allows to do much more things and also simplifies the work with the other ones.

In this tutorial we are going to dive into actual examples of working with WooCommerce API, I will show examples of creating and updating products, and also we will try to search them by SKU and delete them.

One more thing – I am a big fan of using WordPress HTTP functions like wp_remote_get() and wp_remote_request(), so we are going to use them below. So no additional steps are needed like installation of a PHP library or anything else.

Create a Post with WordPress REST API from Remote Website