WooCommerce

How to Integrate Custom Payment Gateways with WooCommerce Checkout Block

On my blog you can find a complete tutorial about creating a WooCommerce payment gateway but in the latest versions of WooCommerce (since 8.3 I guess) you may notice that your custom payment method isn’t available in the Checkout block.

For example if you try to deactivate all the payment methods except your custom one on your store, you’ll probably get an error message like this:

Custom payment method is not displaying in the checkout block
Here I am using Storefront theme as an example, but the same error message will appear for any WordPress theme anyway.

But for sure everything is working great when you’re using a legacy [woocommerce_checkout] shortcode.

Yes, it seems like my complete payment gateway tutorial isn’t that complete anymore, but we’re about to change it today by this extra tutorial where I guide you step by step what you should do in order to add the compatibility of your custom WooCommerce payment method for the WooCommerce Cart and Checkout blocks.

That’s what we’re going to achieve by end of this tutorial:

Custom payment gateway integration with WooCommerce checkout blocks

Sure thing, I will also show you some neat extra stuff like adding a custom icon for your payment method.

Importing Products in Multisites

Recently I was testing my new plugin related to a multisite network of WooCommerce stores and noticed that before doing a product import into one of the stores in a network you first need to do some additional network configuration.

I mean if you just go to a product import and try to upload a CSV file for example, you will definitely get an error like that:

product import error when importing WooCommerce product in a Multisite network
Trying to upload a CSV or TXT import file will cause this error when running a WooCommerce store within a multisite network. The error message can be like on the screenshot “Sorry, you are not allowed to upload this file type” or “Sorry, this file type is not allowed for security reasons”.

Understanding HPOS (High-Performance Order Storage)

In this tutorial I would like to guide you through the High-Performance Order Storage (HPOS) feature in WooCommerce – how to turn it on for your store, how it may affect it and how to update your plugins in order to make them work with the latest WooCommerce versions.

Bulk Update Product Stock Quantities

In the previous tutorial we already discussed updating WooCommerce product stock quantities programmatically when we covered how to do it with REST API specifically.

The whole idea can be deconstructed into two simple things:

  1. Connect to woocommerce_product_set_stock (or woocommerce_variation_set_stock action hooks for product variations).
  2. Send a REST API request to /wc/v3/products/{$product_id} (or /wc/v3/products/{$product_id}/variations/{$variation_id} for product variations).

That’s pretty much it. But there is a “but”. If a specific WooCommerce order in your store can contains a lot of products, then you have a problem. For example, there are 50 products in a single order, then guess what? 50 REST API requests are going to be sent in order to sync all the products stock quantities.

So there is no other way than to update the stock quantities in bulk. But how to do it?

Sync WooCommerce Customers Between Stores

We already know from my previous tutorial how you can sync WordPress users between sites using REST API. And I also have a plugin for that. But today we are going to make it a little bit differently – for WooCommerce customers using WooCommerce REST API.

Once again I have plenty of tutorials about WooCommerce REST API on my blog, so those who already had a chance to work with it, they will learn nothing new here, I guess.

Indeed, the example in this tutorial is quite simple – we are going to go to any user profile settings, hit “Update User” button and we expect those changes to be reflected on the other WooCommerce store. As simple as that.

Set a Customer Role after Purchasing a Specific Product

This whole process of changing a user role after making a purchase in WooCommerce actually consists of two steps:

  1. We have to decide about the hook, when exactly we are going to do a role switching, because there are plenty of them.
  2. Check the order if there is a specific product (or products) and do the thing.

How to Gray-out Out of Stock Variations

In this tutorial we will try to make specific variations (out of stock ones) in the variations dropdown list not selectable:

how to grey out WooCommerce variations in the dropdown which are out of stock

By default WooCommerce allows to select a variation even if it is out of stock and as a result we have a frustrated customer who sees this sad smiley instead of an active “Add to cart” button:

example of out os stock variation in WooCommerce