How to Use the WooCommerce Control


Features in this article require Block Visibility Pro

Control Overview

Built exclusively for the WooCommerce plugin, this control allows you to create dynamic block content based on a variety of store-related rules. From the quantity of products in a customer’s cart to their total lifetime orders in your store, there is no easier way to personalize the shopping experience. Additional highlights include:

  • 18 conditional visibility rules and counting
  • Full support for products with variable pricing

While eCommerce personalization is not a new concept, the WooCommerce control in Block Visibility Pro allows you to work seamlessly in the Block Editor with blocks you are already familiar with. There is no external content editor or interface to deal with. If you are looking to increase sales and improve customer engagement while using native Gutenberg blocks for messaging, this is the solution for you! 

Usage Examples

There are many applications for the WooCommerce control. Here are a few examples to get you started.

  • Recommend additional products at checkout based on what items the customer has already added to their cart with the Cart Contents rule.
  • Reward loyal customers with a special coupon based on how much they have spent in your store with the Total Spent rule.
  • Dynamically display a “Free Shipping” message at checkout based on the total value of the shopping cart with the Total Cart Value rule.
  • Display a custom message when a product is out of stock with the Product Inventory rule.
  • Combine with the Date & Time control to run a timed promotion where customers are encouraged to purchase a specific product. You could then dynamically hide the promotion when the product inventory reaches a specific value with the Amount of Product in Stock rule to avoid oversells.
  • Display messaging to all customers that have not purchased a product in the last year with the Time Since Order rule.

Configuration

How to Enable

Begin by installing and activating the WooCommerce plugin. The control will not be available if the plugin is inactive.

Click on any block in the Block Editor and navigate to the Visibility panel. You will notice an ellipsis icon in the Controls Toolbar. See the screenshot below. Click on the ellipsis, and all available visibility controls will appear. Select “WooCommerce” to add the WooCommerce control panel to the selected block.

WooCommerce control in the block settings sidebar (v1.9)
WooCommerce control in the block settings sidebar (v1.9)

How to Configure

Instructions are always better with examples. Let’s configure the block to be visible if the current customer has spent more than $1000 in your WooCommerce store and they have completed 2 or more separate orders.

The WooCommerce control uses rules and rule sets to determine if the block should be visible. A thorough overview of each available rule is provided below.

Steps to Complete

  1. Navigate to the WooCommerce control settings in the Visibility panel.
  2. Choose “Total Spent” from the rules selector.
  3. Choose “Is greater than” from the condition selector.
  4. Enter 1000 in the value field.
  5. Click on the “Add rule” button to add a second rule.
  6. Choose “Total Orders” from the rules selector.
  7. Choose “Is greater or equal to” from the condition selector.
  8. Enter 2 in the value field.

The resulting configuration should resemble the screenshot below.

Configuring the WooCommerce control (v1.9)
Configuring the WooCommerce control (v1.9)

How to Disable

If you would like to disable the WooCommerce control at the block level, simply click on the ellipsis icon in the “Controls” toolbar and deselect it. The control can also be disabled globally in the plugin’s Visibility Control Settings.

Note that if this control is disabled globally or the WooCommerce plugin is deactivated, any blocks that are actively being hidden by the WooCommerce control will become visible again.

Rules and Rule Sets

Similar to other controls, rules and rule sets power the WooCommerce control. A “rule” is simply a conditional. A “rule set” is a collection of rules.

All rules within a rule set must be satisfied for the selected block to be visible. However, you can create multiple rule sets. Only one rule set needs to apply for the block to be visible. 

Within a rule set, you are creating AND conditions between multiple rules. Between two rule sets, you are creating OR conditions.

There are instances when rule errors can occur. This can happen when rule inputs are not completely filled out or if the rule is based on a product that has since been deleted from your store. In these situations, the plugin defaults to showing the block unless other rules apply, which would hide the block.

WooCommerce rules and rule sets in the block settings sidebar (v1.9)

Cart Rules

The WooCommerce control contains a robust set of cart-based rules which are perfect for providing up-sells, product recommendations, free shipping notices once the cart value has reached a certain threshold, and more. 

Cart Contents

This rule evaluates the contents of your WooCommerce cart. Is the cart empty or not? Does the cart contain specific products or products with specific categories? 

The available sub-fields are:

  • Is empty
  • Is not empty
  • Contains (Products) – Contains specific products
  • Contains (Categories) – Contains products with specific categories

If Contains (Products) or Contains (Categories) are selected, you will be presented with your choice of condition and then you will choose the specific products or categories for the rule to evaluate. 

The available conditions are:

  • At least one of the selected – At least one of the selected products or categories is present in the cart.
  • All of the selected – All of the selected products or categories are present in the cart. There could be additional products and categories as well.
  • None of the selected – None of the selected products or categories are present in the cart.

Total Products in Cart

This rule evaluates the total number of products in your WooCommerce cart. The total includes the number of each product, not just the number of unique products in your cart. 

Example

Assume the cart contained 5 White Shirts and 1 Black Pants. The Total Products in Cart would be 6. 

Total Cart Value

This rule evaluates the total value of all products in your WooCommerce cart.

Quantity of Product in Cart

This rule evaluates the total quantity of specific products in your WooCommerce cart. You can select multiple products, but the quantity value is evaluated per product and must be satisfied for all products for the rule to pass.

Example

Assume there are 5 White Shirts and 1 Black Pants in the cart. 

You choose both White Shirt and Black Pants in the product selector and set the rule to Is greater than a quantity of 2. In this case the rule would fail and the block would not be shown. There is only one pair of Black Pants in the cart, not 2. 

Instead, if you only chose White Shirt in the product selector and set the rule to Is greater than a quantity of 2, the block would be shown. Given this setup, we don’t care how many other products there are, only the number of White Shirts. 

Quantity of Category in Cart

This rule evaluates the total quantity of products in a specific category in your WooCommerce cart. You can select multiple categories, but the quantity value is evaluated per category and must be satisfied for all categories for the rule to pass. In other words, the quantity value applies to the number of products in each category, not the total products across all categories.

Example

Assume there are 2 White Shirts, 3 Red Shirts, 2 Blue Pants and 1 Black Pants in the cart. The shirts are part of the Shirts category and the pants are part of the Pants category. 

You choose both Shirts and Pants in the category selector and set the rule to Is greater than a quantity of 4. In this case the rule would fail and the block would not be shown. There are only a total of 3 products (2 Blue Pants and 1 Black Pants) in the cart from the category Pants, not 4. 

Instead, if you only chose Shirts in the product selector and set the rule to Is greater than a quantity of 4, the block would be shown. Given this setup, we don’t care how many other products there are, only the number of products from the category of Shirts. 

Customer History Rules

Customer History rules require the customer to be logged in to function. If the customer is not logged in, and such rules are applied to the block, the rules will fail, which causes the block to be hidden.  

Total Spend

This rule evaluates the total lifetime spend of the logged-in customer in your WooCommerce store. 

Total Orders

This rule evaluates the total unique orders made by the logged-in customer in your WooCommerce store. 

Average Order Value

This rule evaluates the average order value of the logged-in customer in your WooCommerce store. 

Quantity of Products Ordered

This rule evaluates the total quantity of specific products that the current logged-in customer purchased from your WooCommerce store. You can select multiple products, but the quantity value is evaluated per product and must be satisfied for all products for the rule to pass. 

Example

Assume the customer ordered 5 White Shirts and 1 Black Pants. 

You choose both White Shirt and Black Pants in the product selector and set the rule to Is greater than a quantity of 2. In this case the rule would fail and the block would not be shown. The customer only purchased one pair of Black Pants, not 2. 

Instead, if you only chose White Shirt in the product selector and set the rule to Is greater than a quantity of 2, the block would be shown. Given this setup, we don’t care how many other products there are, only the number of White Shirts. 

Quantity of Category Ordered

This rule evaluates the total quantity of products in a specific category that the current logged-in customer purchased from your WooCommerce store. You can select multiple categories, but the quantity value is evaluated per category and must be satisfied for all categories for the rule to pass. In other words, the quantity value applies to the number of products in each category, not total products across all categories.

Example

Assume the customer purchased 2 White Shirts, 3 Red Shirts, 2 Blue Pants and 1 pair of Black Pants. The shirts are part of the Shirts category and the pants are part of the Pants category. 

You choose both Shirts and Pants in the category selector and set the rule to Is greater than a quantity of 4. In this case the rule would fail and the block would not be shown. The customer only purchased 3 products (2 Blue Pants and 1 Black Pants) from the category Pants, not 4. 

Instead, if you only chose Shirts in the product selector and set the rule to Is greater than a quantity of 4, the block would be shown. Given this setup, we don’t care how many other products there are, only the number of products from the category of Shirts. 

Time Since Order

This rule evaluates the total number of days since the customer’s first, or last, completed order of any product in your WooCommerce store.

Time Since Product Ordered

This rule evaluates the total number of days since the customer’s first, or last, completed order of a specific product from your WooCommerce store. You can select multiple products, but the number of days is evaluated per product and must be satisfied for all products for the rule to pass. 

Time Since Category Ordered

This rule evaluates the total number of days since the customer’s first or last completed order of products in a specific category from your WooCommerce store. You can select multiple categories, but the number of days is evaluated per category and must be satisfied for all categories for the rule to pass.

Date of Order

This rule evaluates when the customer’s first or last order was completed for any product in your WooCommerce store.

Date of Product Ordered

This rule evaluates when the customer’s first or last order was completed for a specific product from your WooCommerce store. You can select multiple products, but the order date is evaluated per product and must be satisfied for all products for the rule to pass. 

Date of Category Ordered

This rule evaluates when the customer’s first or last order was completed for products in a specific category from your WooCommerce store. You can select multiple categories, but the order date is evaluated per category and must be satisfied for all categories for the rule to pass.

Product Rules

There are currently two product rules available in the WooCommerce control. These rules allow you to conditionally display content based on product inventory and other attributes. Expect more product rules in the future. That said if you are looking to display blocks based on product taxonomies, like categories, that functionality already exists in the Location control

Product Inventory

This rule evaluates the inventory status of the selected product (in stock, out of stock, on backorder).

Amount of Product in Stock

This rule evaluates the total stock quantity of a specific product in your WooCommerce store. You can select multiple products, but the quantity value is evaluated per product and must be satisfied for all products for the rule to pass. 

Example

Assume there are 5 White Shirts and 1 Black Pants in stock. 

You choose both White Shirt and Black Pants in the product selector and set the rule to Is greater than a quantity of 2. In this case, the rule would fail, and the block would not be shown. There is only one pair of Black Pants in stock, not 2. 

Instead, if you only chose White Shirt in the product selector and set the rule to Is greater than a quantity of 2, the block would be shown. Given this setup, we don’t care how many other products there are, only the number of White Shirts. 

Hide When Rules Apply

By default, the block will be visible if the applied rules are satisfied. Simply toggle the “Hide when rules apply” setting to hide the block instead.


Upgrade to Pro today!

Unlock block location controls, eCommerce integrations, advanced block scheduling, and more!