Display Product Variations Dropdown on the Shop Page

In this tutorial I am going to show how you can create your own variation dropdowns on the shop page (or any archive product page). When I’m saying “creating your own”, I mean it exactly, so we don’t just copy and paste a couple of hooks from single product pages.

Our another goal here is making sure that AJAX add to cart buttons are working great for our custom variation dropdowns as well.

Here on the screenshot I am showing what exactly we are going to create in this guide:

custom variations select dropdown on the shop page
Selecting a variation with two attributes on the Shop page and adding it to cart with AJAX.

And also If you would like something more interesting, like on the screenshot below, with variation swatches, then consider checking my variation swatches plugin.

AJAX Add to Cart – How it Works

In this tutorial guys I would like to deconstruct for you how an asynchronous adding products to cart works in WooCommerce and we are also going to create some custom “ajax add to cart” buttons here.

WooCommerce AJAX add to cart

Multisite Order Sync in WooCommerce

I’ve been talking a lot about WordPress Multisite synchronisation throughout my blog. And also I have multiple plugins for that, for example – if you are looking for a way to sync WooCommerce products, you can check this plugin, only product inventory – this one.

And right now I would like to talk about WooCommerce orders, specifically about a scenario when you want all the order across your Multisite network to appear on a single store and (optionally) to be removed from the original store where this order has been made.

Speeding Up WooCommerce API

I’ve been working with WooCommerce REST API for quite a while now, well, I developed a couple of plugins – Simple WordPress Crossposting and Simple Inventory Sync and both of them are relying on WooCommerce REST API.

And when you develop something that is intended to be used not only on your test website with 5 products total but also on high load websites, when orders can contain more than 100 products and variations, of course you should always keep performance in mind.

In this tutorial I will share with you some simple simple yet effective tips and tricks.

Update Products and Variations Stock from CSV

In this tutorial I would like to share with you a ready to use example how you can sync WooCommerce products and variations inventory with a CSV file automatically.

Our CSV file is going to look like this:

sync WooCommerce product stock quantities with CSV files
Of course, if you’re going to use the file just to sync stock quantities, ID and Name columns better be removed.

To make this tutorial a little bit simpler we are going to put the file in the WordPress uploads folder, but for sure you can create a WooCommerce settings page where you can upload it.

Reduce Product Stock Quantities Conditionally

When you turn the option “Manage Stock” on for your WooCommerce products (or variations), then every time an order is made, stock quantity of the products from the order is going to be automatically decreased.

But sometimes you don’t need that, or just need it for specific order statuses or payment methods. In this tutorial I will show you how you can do that.

Multiple Products from the Same Stock

In this tutorial I will show you how you make both Stock Quantity and Stock Status to be automatically shared between different products on your WooCommerce store. But if you come to this tutorial looking for a product inventory synchronisation tool between different WooCommerce stores, then please take a look at my plugin.

Also I am going to show you an example with variations of the same product.

The whole idea is pretty simple and can be breaked down into two steps:

  1. Creating a custom function connected either to the woocommerce_product_set_stock or to the woocommerce_variation_set_stock action hook if we talking about variations.
  2. Obtaining the connected products and to setting the same stock values for them.

Easy peasy.