Conditional WooCommerce Products Display

While blocking or showing different products based on the user’s location is not a built-in option, If-So, in general, provides the ability to display dynamic content according to the user’s location.

Option 1: Displaying Dynamic Content Based on User Location (or any other condition)

If you want to utilize If-So to display conditional products, you can create an If-So trigger (with a geolocation condition or any other). Then, you can use one of WooCommerce’s shortcodes to display only the relevant products.

Here’s an example of a trigger with three versions (you can create as many versions as you need):

Version A:

IF: Geolocation > State > Is  > Texas

[products limit="8" columns="4" category="Category#1"]

Version B:

IF: Geolocation > State > Is  > Florida

[products limit="8" columns="4" category="Category#1"]

Default Version:

[products limit="8" columns="4" category="Category#3"]

Helpful links

Important Considerations

  1. In case you are using the geolocation condition, please note that the geolocation service relies on IP-to-location mapping, which may not be 100% accurate. While we utilize a premium, highly accurate database to ensure the best possible accuracy, some discrepancies may occur. You can find more information about IP-to-location services and how they work here.
  2. If your site includes a “search products” option, the products will appear in the search results based on their relevance to the search query.

Option 2: Creating conditional redirect from the product page

Instead of using the method suggested above, you can create a conditional redirect from the product page to a different page (product or other).

This option is more useful if you have a single product that you want to display in one state and a different variation of it that you want to display in another state.

How to create a conditional redirect.