I'm sure this has something to do with the parse order or it might be a bug. I'm trying to set a Stash variable in the first matrix row. After looking at the template debugging, Stash sets the variable in each loop of the matrix, thus not listening to the conditional.
{matrix_field}
{if row_count == 1}{exp:stash:set name="my_var"}{option_value}{/exp:stash:set}{/if}
...
{/matrix_field}
If I add a static character inside the conditional, it only parses once.
Update
I added replace="no"
parameter to the stash:set
tag which fixed the variable from being overwritten once it's set. However, I would still like to know if setting the variable like the above is possible or if I'm approaching it the wrong way.
Update 2
I'm running a CartThrob site that has a ton of price modifiers (PM) for buying sheds online. A user can choose between several options, colors & other upgrades to build and buy a shed online. The site relies heavily on javascript which uses variables to construct files paths and other logic. Some PM fields I need to capture the 'default' options (first row of matrix field) to set variables for file paths and pricing logic. So instead of adding a ton of matrix pairs to the template where needed, I'm trying stay as DRY as possible. Hopefully that makes sense?
Live Example, view console to see some variables (soft launch right now as we are adding more styles)