# Conditional Logic

With the [YayMail Conditional Logic Addon](https://yaycommerce.com/yaymail-addons/conditional-logic-addon-for-yaymail?utm_source=yaymail-docs\&utm_medium=docs-conditional-logic), you can choose to display any elements or WooCommerce blocks in the email when one or more conditions are satisfied.

Here are the options provided in YayMail conditional statements.

**2 logical operators:**

* All: Returns true if all conditions are true.
* Any: Returns true if at least one of the conditions is true.

**3 comparison types:**

* is
* is not
* contains all

**And various conditional object properties:**

* Product
* Product category
* Product SKU
* Minimum order total&#x20;
* Maximum order total
* Payment method
* Shipping method
* Billing country
* WooCommerce coupon code

Below you will find an overview table of how it works for a product condition under different cases. The **Result** column shows the visibility of the email block.

| Object  | Settings           | Order items | Result   |
| ------- | ------------------ | ----------- | -------- |
| Product | is: A              | A           | show     |
|         | is: A              | A, B        | show     |
|         | is not: A          | A           | not show |
|         | is not: A          | B           | show     |
|         | is not: A          | A, B        | not show |
|         | is not: A, B       | A           | not show |
|         | is not: A, B       | C           | show     |
|         | is not: A, B       | A, B        | not show |
|         | contains all: A, B | A           | not show |
|         | contains all: A, B | A, C        | not show |
|         | contains all: A, B | A, B        | show     |

For instance, you can add a **Featured Products** section to your email body. And then, create a condition to allow displaying it in emails if the ordered product belongs to a specific category.

<figure><img src="https://157604815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJfBhHG_1ipE5lMX4qT%2Fuploads%2Fb9PTeqWMSNVmp9jORkp9%2Flist-conditional-logic.png?alt=media&#x26;token=d721eaed-ce1a-4cc8-b116-0d8962f96faf" alt="List of Conditional Logic"><figcaption><p>List of conditional logic in YayMail</p></figcaption></figure>

By choosing **Product category is "Tshirts"**, you will be able to display these related products when a customer has bought a t-shirt.

<figure><img src="https://157604815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJfBhHG_1ipE5lMX4qT%2Fuploads%2Fr3N2SoRMghwgV0fyvyhD%2Fchoose-conditional-logic.png?alt=media&#x26;token=694b920e-f8be-4d9b-a9fd-4b591c0578e9" alt="Choose Conditional Logic in YayMail"><figcaption></figcaption></figure>

With this setup, when a customer buys a t-shirt, they will receive an order confirmation email. This email includes links to other product categories in your shop that you have set. So that you boost the chance of customers visiting your store and further browsing Hoodies/Caps categories.

{% embed url="<https://youtu.be/KzffDxrM00I>" %}
How to customize your Woocommerce emails to show/hide email content block
{% endembed %}

Other **WooCommerce conditional logic** options include but are not limited to:

* Billing country is/is not
* Product category is/is not/contains all
* Product is/is not/contains all
* Product SKU is/is not/contains all
* Minimum order total
* Maximum order total
* Payment method is/is not
* Shipping method is/is not
* Coupon codes is/is not/contains all
* Booking Payment status is/is not

Payment method includes: Direct Bank Transfer, Check Payment, Cash on Delivery, PayPal, Stripe, etc.

Shipping method includes: Flat rate, Free Shipping, Local Pickup, etc.

Booking Payment status includes: Pending Payment, Processing.

Or you can even register a [new conditional logic for customer roles](https://docs.yaycommerce.com/yaymail/addons/conditional-logic/logic-for-customer-role).&#x20;

Happy customizing! 🪄
