> For the complete documentation index, see [llms.txt](https://docs.yaycommerce.com/yaymail/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yaycommerce.com/yaymail/visibility-control.md).

# Visibility Control

Add display conditions to make specific content visible or hidden for a group of customers.

With **YayMail Pro/Free** and the **YayMail Conditional Logic** addon, you can control **when and to whom** specific content appears.

This feature allows you to **show or hide any content block** based on one or more conditions — giving you the flexibility to tailor email messages based on order details, customer roles (coming soon!), purchased products, payment methods, and more.

💫 For example:

* Show a discount code **only when customers order between $50 and $100**
* Add special instructions **only for orders with local pickup**
* Display product-specific messages **only when certain items are purchased**

No more one-size-fits-all emails — Conditional Logic helps you deliver personalized, relevant content in every message. 💪

### How it works

**Two ways to use YayMail Pro with** [**YayMail Conditional Logic**](https://yaycommerce.com/yaymail-addons/conditional-logic-addon-for-yaymail?utm_source=yaymail-docs\&utm_medium=docs-conditional-logic)**.**&#x20;

The add-on works at two levels, and both use the same conditions:

* **Block visibility:** shows or hides a single block inside an email. The rest of the email stays the same.
* **Template variants:** let you create alternative designs for the same email. YayMail sends the design that matches your conditions.

Use block visibility when only a small part of the email changes, such as a coupon or a note. Use template variants when different audiences need a different layout, branding, or tone. If you'd otherwise hide and show lots of blocks at once, a variant is usually easier to maintain.

#### Conditions you can use

You can display a block, or send a template variant, when one or more of the following conditions are met.

**Customer**

* Customer role - The WordPress user role of the person who placed the order, such as Customer, Subscriber, or a custom Wholesale role. See Show content by customer role below.
* Customer type - Whether the customer is, for example, a first-time buyer.
* Customer order count - How many orders the customer has placed.
* Account age - How long the customer's account has existed.

**Order**

* Order status - For example, Completed.
* Minimum order total and Maximum order total - Use one or both to target orders within a price range, such as $100 to $500.
* Number of line items - How many different items are in the order.
* Contains virtual/downloadable products - Whether the order includes virtual or downloadable products.
* Coupon code - Whether a particular coupon was used, such as BLACKFRIDAY.

**Products**

* Product, Product category and Product SKU - Match orders containing particular items. For example, show care instructions when the order contains a product in the 'Beanie' category.

**Payment and shipping**

* Payment method - For example, cash on delivery (COD).
* Shipping method - For example, Fast delivery.
* Billing country and Shipping country - For example, US.

**Date and time**

* Send date/month - The date or month when the email is sent.
* Send day of week - The day of the week when the email is sent.
* Order placed on weekend - Whether the order was placed on a Saturday or Sunday. For example, you could add a note about slower processing over the weekend.

**Bookings**

* Booking payment status - For example, Pending payment.

<figure><img src="https://157604815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJfBhHG_1ipE5lMX4qT%2Fuploads%2FJ7uYcyLLugEJszDv1lsH%2FAdd%20more%20conditional%20logic%20for%20YayMail%20template.png?alt=media&amp;token=0d178e1d-ecce-4f20-be4d-ea64473c2f80" alt=""><figcaption></figcaption></figure>

The dropdown in the email editor shows the conditions available on your site. Conditional Logic includes more conditions than the ones above.

#### Combining conditions

You can add more than one condition to a block or variant, and choose how they work together:

* **All** - Every condition must be true.
* **Any** - At least one condition must be true.

For example, to show a bulk-order message only to large wholesale orders, set **Customer role is Gold Wholesalers** and **Minimum order total is $500**, and choose **All**. To show a welcome banner to either of two groups, use Any instead.

#### Show content by customer role

Customer role lets you show or hide content based on the WordPress user role of the person who placed the order. Every registered user on your site has a role (such as Customer or Subscriber), and YayMail checks it when the email is generated.

This is useful when different groups of customers should receive different messages from the same email template.

A role is a label WordPress assigns to each user account that defines what they can do on your site. YayMail reads this label from the customer's account at the time the email is sent.

<figure><img src="https://157604815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJfBhHG_1ipE5lMX4qT%2Fuploads%2FI3hbygmFxakkmn23sItJ%2FYayMail%20Conditional%20Logic%20for%20customer%20role.png?alt=media&amp;token=012b133b-8dd3-42d0-a65d-500e0ff38f8e" alt=""><figcaption></figcaption></figure>

The dropdown lists every role available on your site, including:

* Default WordPress roles - Administrator, Editor, Author, Contributor, and Subscriber.
* WooCommerce roles - Customer and Shop Manager.
* Custom roles - Roles added by other plugins or your own code. For example, a B2B or Wholesale/Retail role, Bookster Agent/Manager, YayWholesale Role, Premium Member, Nonprofit organization, Educational Institution, Gastronomy Business, Gold Wholesalers, Silver Wholesalers, or VIP.

The list depends on the plugins on your site, so you may see different custom roles from the ones above.

<figure><img src="https://157604815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJfBhHG_1ipE5lMX4qT%2Fuploads%2FPQCqC9zYP3FYCz7kDXbl%2FThe%20details%20customer%20role%20of%20conditional%20logic.png?alt=media&amp;token=ac6e04e6-b762-4be8-843c-a14d062c6c24" alt=""><figcaption></figcaption></figure>

#### Send a different design with template variants

Block visibility changes small parts of an email. Template variants go further: you create completely different designs for the same email, and YayMail sends the one that matches your conditions.

Each email (for example, New order) has a Default design. You can add more variants, give each its own layout and content, and set conditions that decide when it is used.

<figure><img src="https://157604815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJfBhHG_1ipE5lMX4qT%2Fuploads%2FoGZy2aOdOS4GidTNKkAG%2FTemplate%20Variants%20for%20conditional%20logic.png?alt=media&amp;token=613178b8-712f-4261-9d6c-a588d1c56d77" alt=""><figcaption></figcaption></figure>

For example:

* Send wholesale (B2B) customers a branded, minimal order confirmation, and everyone else your standard design
* Use a dedicated layout for local pickup orders with pickup instructions, and a different one for shipped orders
* Send a VIP design with a thank-you message when a specific coupon code is used
* Show a different design by billing country, such as localized content for the US

<figure><img src="https://157604815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJfBhHG_1ipE5lMX4qT%2Fuploads%2FbUdPYbkKXvuyWF4Ld8TQ%2FEdit%20template%20variants.png?alt=media&amp;token=5fcde3b2-36b4-474c-93a8-a1e5ed37cda5" alt=""><figcaption></figcaption></figure>

Variants save time compared with building and maintaining separate hide/show rules across many blocks. You edit one design per audience and keep it intact.&#x20;

Only published variants are considered when YayMail chooses which design to send. An unpublished variant is skipped, so you can build and test it without affecting customers.&#x20;

Want to kickstart it? Check out [YayMail Conditional Logic addon](https://docs.yaycommerce.com/yaymail/addons/conditional-logic?utm_source=gitbook\&utm_medium=yaymail\&utm_campaign=conditional-logic)
