[Guide] Updating products in WooCommerce

Table Of Contents

  • Introduction
  • Step 1: Create an outgoing configuration
  • Step 2: Create a route
  • Additional information

Introduction

This article describes how to update products in WooCommerce.

Step 1: Create an outgoing configuration

  • Navigate to “Connections” in the menu and select “Outgoing”.
  • Create a new outgoing configuration to setup the process of updating WooCommerce products.
  • Insert a name in the “name” field.
    1. For example: “WooCommerce – Products – Update a product”.
  • Under “Publisher” select “WooCommerce - Product - Create or update Product”.
  • Under “WooCommerce HTTP client” select the HTTP client that you created during the initial setup.
  • Click “Add entity transformer” and select “WooCommerce - Product - Restructure from Alumio product”.
    1. This transformer converts data from the Alumio product schema to a format that WooCommerce understands.

Note: The publisher expects the product ID to be present in the “identifier” field in the data that is passed to the outgoing configuration. When you don’t know the product ID at this point, see step 3 for a way to find the product ID based on SKU.

Step 2: Create a route

Next you’ll create a route to bind the incoming configuration to the outgoing configuration. In the route, you’ll need to select the outgoing configuration you created in the previous steps.

On the following links, you can find more information about creating routes and incoming configurations and subscribers.

Step 3: (Optional) Get the product ID from WooCommerce by looking up a SKU

When you don’t already know the product ID or whether the product already exists, you can look it up by searching for a SKU in the WordPress website using the following steps.

  • In the route, click “Add entity transformer” and select the “WooCommerce - Product - Find Product by SKU” transformer.
  • Under “WooCommerce HTTP client” select the HTTP client that you created during the initial setup.
  • Under “Sku”, specify the path where the product’s SKU is stored within the data, using the “&{}” notation.
    1. For example: “&{sku}” or “&{product.sku}”.

  • Click “Add entity transformer” at the bottom of the page and select the “Data, transform data using mappers and conditions” transformer.
  • Click “Add filter” and select “Value condition”.
  • Under “Accessor” select “Pattern accessor”.
  • Under “Pattern” insert “WooCommerceProduct”.
  • Select “Add conditions” and select “Is not empty”.

  • Click “Add data transformer” and select “List mapper”
  • Under “Accessor”, select “Key accessor”
  • Click “Add mapper” and select “List: Extend with supplied data”
  • Under “Array”, fill in the following template:
{
   "identifier": "&{WooCommerceProduct[0].id}"
}

HTML

Additional information

If you added the check in step 3, no task will be created in your Alumio dashboard if the SKU does not already exist in the WooCommerce website.

There’s also a transformer available (“WooCommerce - Product - Create or update Product with sending data”) that has the same functionalities as this outgoing configuration. You can use this in case you like to add additional steps in your route after you created the product. You can combine the SKU check in step 3 with this transformer.

It’s currently not possible to update an individual variant.

You could use the “WooCommerce - Product - Find Product by SKU” transformer to get product data based on SKU.

This outgoing configuration uses the Alumio product schema.

That’s it!

You should now be able to update products in WooCommerce!