Forum Discussion

ueda_1220's avatar
ueda_1220
Active Member
2 months ago

How to use selections in webhook

Hello, everyone.

Could you tell me how to use selections in webhook if you know that?

I want to assign the return value of a selection to a variable.

I have listed the following LIQUID, but it does not work.

{% assign tmp = {% catalog_selection_master_for_attribute %}{{ items[0].product }}%}

 

  • ueda_1220 I have not tried it

    Try if this works for you
    {% catalog_selection_master_for_attribute %}

    {% assign tmp = items[0].product  %}



5 Replies

  • ueda_1220 I have not tried it

    Try if this works for you
    {% catalog_selection_master_for_attribute %}

    {% assign tmp = items[0].product  %}



    • ueda_1220's avatar
      ueda_1220
      Active Member

      Thank you for your answering.
      But I'm afraid your code didn't work well..
      I further tried modifying the liquid as follows, but it did not work.

      {% catalog_selection_master_for_attribute %}

      {% assign tmp = {{items[0].product}}  %}

    • ueda_1220's avatar
      ueda_1220
      Active Member

      There was a mistake in the area of checking.
      I double checked and found that it works well with what you have indicated.
      Thank you for your response!

  • inespais's avatar
    inespais
    Practitioner II

    Hey ueda_1220, the code structure Manoj__ shared looks correct. I think what you're missing is the Selection part after the catalog name - I set up a dummy one below (see bold):

    {% catalog_selection_items IP_Test Selection1 %}
    {% assign tmp = items[0].item1 %}
    {{tmp}} --> returns expected value
     
    When you're adding Personalization you can choose Selection from the drop-down:

     

    • ueda_1220's avatar
      ueda_1220
      Active Member

      Thank you for responsing.

      I checked that and you are right.