Since {{ increment amount }} outputs your variable value, and does not affect the variable defined by {% assign %} , I suggest you use {% capture %} :
{% assign amount = 0 %} {% for variant in product.variants %} {% capture amount %}{{ amount | plus:1 }}{% endcapture %} {% endfor %} Amount: {{ amount }}
I agree that this is verbose, but AFAIK is the only working solution.
zessx source share