---
title: "How to skip lines in a dynamic table block"
description: "Learn how to skip rows (e.g., items) in a dynamic table block. The most common use case for this is hiding irrelevant items, like shipping insurance or free gift items, from an abandoned cart email. However, you can follow these steps for any email that uses a dynamic table block."
canonical_url: "https://help.klaviyo.com/hc/en-us/articles/25825620314651"
markdown_url: "https://help.klaviyo.com/hc/en-us/articles/25825620314651.md"
locale: "en-us"
category: "Content"
section: "Use variable syntax and tags"
updated: "2026-10-29"
---

# How to skip lines in a dynamic table block

## You will learn

Learn how to skip rows (e.g., items) in a dynamic table block. The most common use case for this is hiding irrelevant items, like shipping insurance or free gift items, from an abandoned cart email. However, you can follow these steps for any email that uses a dynamic table block. 

**📝 Note:** This process involves directly editing your email’s code. This is only recommended for technically savvy marketers or those who have access to a developer. Our support team cannot help you write custom code beyond the general guidance covered in this documentation. To maintain the security of your data, Klaviyo's support team is not able to open HTML files.

## Before you begin

This article covers how to hide items from existing dynamic table blocks. If you have not yet created a working dynamic table block (e.g., the products in an abandoned cart or order confirmation email), learn how to [create one from scratch](https://help.klaviyo.com/hc/en-us/articles/4408802597659.md) or start with a message in our [flow library](https://help.klaviyo.com/hc/en-us/articles/115002779411.md). 

These steps require the **HTML** option under **Cell content** in your dynamic table block.

**📝 Note:** Before editing your dynamic table block, consider saving the original block as universal content in case you need to reference it in future messages. Then unlink the block and edit it separately, so your edits aren’t saved to the universal content block.

If your email is part of a flow, set it to **Draft** or **Manual** before editing so messages don’t send automatically while you make changes.

## Write your *if* statements

Create 2 code snippets using a text or code editor (somewhere you can copy and paste the snippets from later): 1 for the product image and 1 for the product details. Each code snippet will consist of 3 parts:

1. [An opening ](#h_01HY3CPMXG09XHJQTMZP0VJV82)[*if*](#h_01HY3CPMXG09XHJQTMZP0VJV82)[ tag](#h_01HY3CPMXG09XHJQTMZP0VJV82), `{% if ... %}`, indicating which items should appear in your table block. 

2. [Content](#h_01HY3CPMXGEPNZ4B9JC9SS91F2), like an image tag or text about the product.

3. [A closing tag](#h_01HY3CPMXGHQ358JG8EH463SGG), `{% endif %}`.



### Create the opening *if* tag

Here are some examples of opening *if* tags: 

| **Tag** | **Meaning** |
| --- | --- |
| {% if item.price != 0 %} | If the item price (*item.price*) is anything other than 0. |
| {% if item.product.name != "Route Shipping Insurance" %} | If the item name (*item.product.name*) is anything other than “Route Shipping Insurance.” |
| {% if not "T-Shirt" in item.product.title %} | If the item’s title (*item.product.title*) does not contain “T-Shirt.” |
| {% if item.title %} | If the item’s title (*item.title*) is set (i.e., has any value). |

**📝 Note:** These tags are case sensitive and must match your data exactly. For example, if the variable for your item’s price is something other than *item.price* (e.g., *item.Price* or *item.details.line_price*), update the code to match your data source.

The examples use `item` as the **Row alias**. Replace it if your table uses a different alias. The price example compares against the number `0`; if your data stores prices as text, compare against the exact text value instead, such as `{% if item.price != "0.00" %}`.

### Create the content for the if statement

For content, follow these steps to use the existing content from your dynamic table block. Write this code snippet in a code or text editor; you’ll add it to your template in the next section. 

1. Select the image cell in your table block. Under **Cell content**, click **Replace** to view the image placeholder.



![Replace cell content button.jpg](https://cdn.sanity.io/images/6ct6b26e/help-center-prod/8c9410006bb9fa56dcbd9143fbe6d92454bddfe4-772x422.jpg?auto=format)

2. Copy the entire code from the **Dynamic variable or dynamic URL** field. Note that this may be a simple dynamic variable, or it may be a longer code snippet; copy all of it, regardless of length. Then close the image picker.



![Abandoned cart product image variable.jpg](https://cdn.sanity.io/images/6ct6b26e/help-center-prod/e322055faf98b615a5893ed242013755a58387ce-1560x560.jpg?auto=format)

3. Replace the placeholder in this code snippet with the code you copied from the **Dynamic variable or dynamic URL** field.




```text
<img src="PLACEHOLDER" style="width: 200px; height: auto;" width="200">
```

This example uses a width of 200 px. To keep your existing image settings, use its **Max width**, add its **Alt text** in an `alt` attribute, and wrap the image in an `<a href="...">` tag using its **Link address**.

If your existing table block has a simple dynamic variable for the image, the resulting content will look something like this: 

```text
<img src="{{item.product.variant.images.0.src}}" style="width: 200px; height: auto;" width="200">  
```

If your existing table block contains a longer code snippet, the resulting content might look like this: 

```text
<img src="{% if item.product.variant.images.0.src %}{{item.product.variant.images.0.src}}{%else%}{{item.product.images.0.src|missing_product_image}}{%endif%}" style="width: 200px; height: auto;" width="200">

```

### Add your ending tag

Then, put all the content together: your opening if statement, then your content, and finally a closing `{% endif %}` tag. 

### Repeat for the text content

Create the second code snippet from the product-details cell:

1. Open the product-details text cell. If a dialog offers **Convert to HTML block**, select it and continue to step 3. Otherwise, select and copy all of the content in the inline text editor.

2. Under **Cell content**, select **HTML**. Paste the content you copied into the code editor, replacing any existing content. If prompted, choose **Paste as HTML**.

3. Copy the resulting HTML into your second snippet in the text or code editor. Wrap it in the same opening **if** tag and closing `{% endif %}` tag you used for the image snippet.



For example, the 2 snippets can look like this for Shopify Started Checkout data. Use the variables and links from your own table:

| **Code snippet 1 (product image)** | **Code snippet 2 (product details)** |
| --- | --- |
| `{% if item.product.title != "Route Shipping Insurance" %} <img src="{% if item.product.variant.images.0.src %}{{item.product.variant.images.0.src}}{%else%}{{item.product.images.0.src\|missing_product_image}}{%endif%}" style="width: 200px; height: auto;" width="200"> {% endif %}` | `{% if item.product.title != "Route Shipping Insurance" %} <h3><a href="{{ organization.url\|trim_slash }}/products/{{ item.product.handle }}">    {{ item.product.title }} </a></h3> <p>    Quantity: {{ item.quantity\|floatformat:0 }} —     Total: {% currency_format item.line_price\|floatformat:2 %} </p> {% endif %}` |

And here’s a breakdown of those code snippets: 

| **Code snippet 1 (product image)** | **Code snippet 2 (product details)** |
| --- | --- |
| `{% if CRITERIA %}    IMAGE PLACEHOLDER CONTENT {% endif %}` | `{% if CRITERIA %}    PRODUCT DESCRIPTION {% endif %}` |

**📝 Note:** When using these code snippets, make sure to use straight quotes (") rather than curly quotes (“) to ensure the code renders correctly.

Once you’ve written both code snippets, continue in the template editor following the steps below. 

## Skip rows in a dynamic table block

1. Select the image cell in your existing dynamic table. Under **Cell content**, select **HTML**.



![Image](https://cdn.sanity.io/images/6ct6b26e/help-center-prod/c97959d7c19afdab81f1eb8dffda1e6b8aed26b2-786x790.jpg?auto=format)

2. Copy the product image code snippet you created in the previous section and paste it into the code editor, replacing any existing content.



![Image](https://cdn.sanity.io/images/6ct6b26e/help-center-prod/5eca4dc5ee041f0f1ed8548ee5578bff63913dc0-798x1126.jpg?auto=format)

3. Select the product-details cell, which you set to **HTML** in the previous section.

4. Copy the product-details code snippet you created in the previous section and paste it into the code editor, replacing all previous content.

5. Preview the email to ensure it appears as expected: the skipped item should not appear, but all other items will appear normally. Make sure to preview with an event that contains the item you’re trying to hide, so you can ensure it is hidden. Also preview an event containing only items you want to hide to check how the rest of the email looks.

6. When you’re finished, wait for your changes to finish saving and exit the email editor. If you changed a live flow email to **Draft** or **Manual**, return to the flow and set that email back to **Live** when you’re ready to resume automatic sending.



These conditions hide the contents of each cell. Empty-row spacing or borders may still appear, so check the layout in your preview.

### Conditional statements and the inline text editor

In a text cell, template tags can appear as editable logic instead of raw code. Select the logic to edit it, then click **Save**. In the HTML cells used above, edit the tags directly in the code editor.

This applies to these template tags:

- {% for ... %}

- {% endfor %}

- {% if ... %}

- {% elif ... %}

- {% else %}

- {% endif %}

- {% with ... %}

- {% endwith %}



## Troubleshooting

**No items appear in the preview**

1. Make sure you are previewing with an event that matches the data source you used (e.g., *Started checkout* for an abandoned cart message). 

2. In the table’s **Styles** tab, confirm that **Row collection** and **Row alias** exactly match the settings from the original block.



**The item that should be skipped is still appearing**

Check that both cells use the same if statement and that it surrounds all of the content you want to hide. Check its spelling, capitalization, row alias, and data type against your event data. Learn more about [conditional logic in templates](https://help.klaviyo.com/hc/en-us/articles/7655926841499.md). 

## Outcome

After following these steps, any items that don’t meet the criteria in your if statement will not appear in messages like abandoned cart or order confirmation emails.

## Additional resources

- [Message personalization reference](https://help.klaviyo.com/hc/en-us/articles/4408802648731.md)
  Learn how to use Klaviyo’s personalization variables, or tags, to customize the experience for your customers.
- [How to import a custom HTML template](https://help.klaviyo.com/hc/en-us/articles/115005254068.md)
  Learn how to import a custom HTML template into Klaviyo. 
