Using variable value insted of reference

Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2
Story Format: Sugarcube 2.35.0

So I want to make a shop of some sorts. I have an array of objects that the store would sell which I iterate through with a loop.

<<set $products= [$axe, $sword, $mace]>>
<<for _i; _i < $products.length ; _i++>>
    <<link "Buy" "store">>
        <<set $products[_i].owned to 1>>

This will produce an error as the _i no longer exists after the loop has finished.

Error: <>: bad evaluation: Cannot read property ‘owned’ of undefined

Is there a way to use the variable value and not the reference to the variable?

Try putting a <<capture _i>> around the <<link>>?

Works perfectly, thanks!