WooCommerce

Creating MetaMask Payment Gateway for WooCommerce

Recently I really enjoyed creating a tutorial about signing in to WordPress with MetaMask, so I decided to continue with this topic and today I will show you how you can create a payment gateway for WooCommerce that allows to pay with MetaMask extension.

I also would like to remind that I already have a complete payment gateway tutorial and additionally a tutorial about paying with crypto. So you can check them out as well.

And this how it is going to work on our WooCommerce store:

MetaMask Payment Gateway for WooCommerce
This is what happens when you click Connect wallet (Place order) button on your WooCommerce checkout page.

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.

Multisite Products Sync for WooCommerce

Let’s assume that you have a WordPress multisite network installed and some (or all) of the sites of the network are WooCommerce stores.

The thing is that sometimes you may need to sync WooCommerce products between the sites of your multisite network.

Because we are talking about WordPress Multisite we are not going to work with REST API, the tutorial will be all around switch_to_blog() function and CRUD layers.

How to Create Product Variations Programmatically

There is also a tutorial on my blog about creating products programmatically where I slightly cover the product variations.

But there are still a couple moments I would like to discuss more thoroughly, I came to them when I was doing the variable products crossposting for my multisite crossposting plugin.

Get Product (or Variation) by SKU

In this tutorial I will show you how to get a product or a product variation object in WooCommerce if you only know its SKU. It is easy-peasy when we get a product object by ID, we just have to use wc_get_product() function, but we can not pass SKU to that function.

So I am going to show you three different ways how you can obtain a product object from SKU, we are going to do it both WooCommerce-way (with WP_Product_Query and with wc_get_product_id_by_sku() function) and WordPress-way (with WP_Query).

How to Display Variations with Color (or Size) Buttons

In this tutorial I will show how you can change the way the variation selection is working on the product page in WooCommerce.

We all know that by default the variations are displayed like a select dropdown.

default variation switcher on WooCommerce product page
Wouldn’t it be better to use color swatches here?

But today we will learn how to display them as color swatches. If you would like to display them as size buttons or custom images, you can do it with my plugin.

This is our goal for this tutorial:

WooCommerce display color variations with buttons

How to Add Custom Fields to Product Variations

Long time ago I published a tutorial where I described how to add custom fields to WooCommerce products. Now it is time to dive deep into product variations and add a couple settings fields there as well.