How to limit product/variant quantity using Shopify Plus Script Editor app?

Viewed 1300

I'm looking for help to limit product/variant quantity using script editor app in Shopify Plus. The goal is to only allow one quantity to be able to add to cart per checkout for some specific variant ids in different products.

1 Answers

There is no supported API for this, but you can update the line item object instance variables directly:

line_item.instance_variable_set(:@quantity, max_quantity)
Related