How to Display WooCommerce Variations as Radio Buttons
In this tutorial, I’d like to show you two approaches to how we can change the appearance of WooCommerce variations on your store and display them as radio buttons instead of dropdown lists.
- First, I will show you how to do it programmatically,
- Also, I will show you how you can do it with a plugin.
As a result, this is how the variations are going to be displayed on product pages:

How to Hide Out of Stock Products
In this step-by-step guide, I would like to show you how you can hide out of stock products and variations on your WooCommerce store (or show them, if they are hidden at this moment).
By default, when a product is out of stock it is still going to be displayed on your shop and archive pages. Instead of the “Add to cart” button, there is going to be displayed the “Read more” button.

Variations JavaScript Events in WooCommerce
Sometimes, when we work with WooCommerce product variations, we need to trigger some custom code when variations are changed, reset, or else.
There are multiple JavaScript events for variations that we can use for our purposes and I will describe each one of them with examples in this tutorial.
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. When we just need to get a product object by ID, we use the wc_get_product() function – super-easy, right? But if we only have an SKU, it is going to be a little bit more interesting.
So, I am going to show you four different ways how you can obtain a product object from its SKU, we are going to do it both the WooCommerce way (with WP_Product_Query and wc_get_product_id_by_sku() function) and the WordPress way (with WP_Query). Also, I will show you how to do it when you interact with the WooCommerce REST API.
Check if a Product Has Variations
In this simple tutorial I’d like to show you easy ways to check whether a specific product has variations or not.
The first thing you need to understand here is that variations are also a custom post type product_variation and “variation posts” are always child in relation to “product posts”.
The second thing is that we have public (“Enabled” checkbox is checked) and private (“Enabled” checkbox is unchecked) variations:

The thing is that depending on whether your variation is public or private, you need to use different functions and class methods.
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.
Delete all Product Variations Using REST API
Recently I have found this question on the internet and since I was doing exactly the same when developing WooCommerce functionality for my crossposting plugin, I decided to create a small guide for you.
The long story short we will need two REST API requests here:
- To get all variations of a specific product,
- To delete all of them in a single batch request.
I think the most clear way here would be to create a function for that, let’s say for example rudr_delete_all_variations() or something.