Skip to main content

Hey Klaviyo Community! πŸ‘‹

I wanted to share a discovery about a limitation with the {% catalog %} tag and a working solution for anyone struggling with dynamic catalog IDs, especially for multi-language setups.

The Problem:

We're using PrestaShop integration with two catalogs for different languages (catalog_id 1:1 for one language, 1:2 for another). We trigger emails based on the "Subscribed to Back in Stock" event, which includes event.ProductID and event.CatalogID.

While the variable renders correctly when displayed directly:

{{ event.CatalogID }}  <!-- Renders: 1:1 or 1:2 correctly -->

The catalog tag refuses to accept it as a dynamic parameter:

❌ What DOESN'T Work:

<!-- This throws an error or defaults to first catalog -->
{% catalog event.ProductID integration="prestashop" catalog_id=event.CatalogID %}
{{ catalog_item.title }}
{% endcatalog %}

<!-- These also don't work: -->
{% catalog event.ProductID integration="prestashop" catalog_id="{{ event.CatalogID }}" %}
{% catalog event.ProductID integration="prestashop" catalog_id=event.CatalogID|default:"1:1" %}

<!-- Even with 'with' tag: -->
{% with cat_id=event.CatalogID %}
{% catalog event.ProductID integration="prestashop" catalog_id=cat_id %}
{% endwith %}

βœ… What DOES Work:

{% if event.CatalogID == "1:1" %}
{% catalog event.ProductID integration="prestashop" catalog_id="1:1" %}
{{ catalog_item.title }}
{% endcatalog %}
{% else %}
{% catalog event.ProductID integration="prestashop" catalog_id="1:2" %}
{{ catalog_item.title }}
{% endcatalog %}
{% endif %}

The Root Cause:

It appears that Klaviyo's template parser evaluates the catalog tag BEFORE rendering variables. The catalog_id parameter only accepts hardcoded string literals, not variables - even though other parameters like the product ID work fine with variables.

Use Cases Affected:

  • Multi-language catalog setups
  • Regional product variations
  • Different pricing tiers/catalogs
  • Any scenario requiring dynamic catalog selection

This likely affects all events that include catalog information, not just "Back in Stock" flows.

Request for Klaviyo Team:

This seems like a bug or significant limitation. Could the engineering team consider allowing dynamic variables in the catalog_id parameter? This would greatly simplify templates for international businesses using multiple catalogs.

Current Workaround:

For now, you need to use conditional statements (if/elif/else) for each possible catalog value. It's not elegant, but it works reliably.

Hope this helps someone else struggling with the same issue! Has anyone found other workarounds or can Klaviyo staff comment on whether this might be addressed in a future update?

Be the first to reply!