Forum Discussion

FlorianGOrnika's avatar
FlorianGOrnika
Active Member II
7 days ago

Find user in catalog

Hello everyone,

I would like to send a message if the zipcode from a user is existing in a catalog.
But I am not very technical.

I have a catalog : 
id--zip_code--link
ex: 14--13001--https://braze.com

I try to make something like:
{% if {{custom_attribute.${zip_code}}} == {{catalog.zipcode}} %}
Show email
{% else %}
abort
{% endif %}

Anyone got the answer?
Best regards.

  • Sorry my bad try this one:
    catalogName: test
    selection: zip

    {% catalog_selection_items test zip %}

    {% if items[0].zip != blank %} not blank {% else %} blank {% endif %}


    if you are not sure about the catalog liquid check in personalization

     

  • Gabriele's avatar
    Gabriele
    Active Member

    Sorry my bad try this one:
    catalogName: test
    selection: zip

    {% catalog_selection_items test zip %}

    {% if items[0].zip != blank %} not blank {% else %} blank {% endif %}


    if you are not sure about the catalog liquid check in personalization

     

    • FlorianGOrnika's avatar
      FlorianGOrnika
      Active Member II

      Thank a lot Gabriele!

      It works, I just changed a parameter in the if items, I publish another example for people in needs :

      catalogName: garage
      selection: website_link
      item: zip_code

      {% catalog_selection_items garage website_link %}

      {% if items[0].zip_code != blank %} not blank {% else %} blank {% endif %}

  • Gabriele's avatar
    Gabriele
    Active Member

    Should be something like that.

    {% if {{ items[0].zip }}  == blank %}
    Show email
    {% else %}
    abort
    {% endif %}

    Please like the answers if were useful 😀

    • FlorianGOrnika's avatar
      FlorianGOrnika
      Active Member II

      Hello Gabriele,

      I did the setup in the catalog, then I tried your solution, but it doesn't work.
      I have the message "This message would not have been shown because of the abort_message tag. The tag was called with message "Selection not found"."

      Ps: my selection name in ctaalog is not "zip_code"

      My liquid:

      {% catalog_selection_items dim_google_my_business_link zip_code %}
      {{ items[0].zip_code }}

      {% if {{ items[0].zip_code }} != blank %}
      Show email
      {% else %}
      abort
      {% endif %}

  • Gabriele's avatar
    Gabriele
    Active Member

    Hi,

    You should first of all make a selection inside your catalog for the attribute zip_code
    https://www.braze.com/docs/user_guide/personalization_and_dynamic_content/catalogs/selections/#liquid-in-selection-results

    Once you have done that go back to your email and insert the liquid below.

    catalog_selection_items - catalogName - selectionName

    {% catalog_selection_items catalogName zip %}

    {{ items[0].zip }}

    Then you have to use the items0 in your if statement using if not empty then display the email otherwise abort.