How can I activate a code section based on user selection?

Hello, I’m having trouble with {%if%} code (section). I want that if someone chooses the option “Yes” (top part of the code) the other part of the code (last part of the code) would activate. This looks like this:


   

 class="line-item-property__field" style="margin-left: 5px !important;">

       

          

{% endif %}

Already thankful for someone who can help because I can’t come around to the solution! I’m not a professional so if other mistakes appear I would love to learn:)

HI @Vyk ,

You need a javascript code for this, not liquid. You can refer to the code below


   

      

 

       
          

Hello @Vyk ,

Hope you are doing well. We have rectified the code for you for setting up a line item property on the product page:-

Please find the code below.

CUSTOM

class="line-item-property__field" id="cstm-name" style="margin-left: 5px !important;display:none;">

NAME

Please let us know if you find our solution helpful. Also, you can connect with us if you have any other questions.

All the best,

Team CedCommerce

Thanks for the work! Amazing!

Thanks for the work! :slightly_smiling_face: