Hey everyone,
I’m trying to write a custom theme from scratch, which means coding the “Add to Cart” system from scratch. I don’t want a quantity button on the page, I just want it to add 1 of the product to the cart.
As far as I’m aware, all you need for this to work is to pass the product’s ID and quantity through a form that posts it to “/cart/add”. However, I can’t seem to get it to work, as it always states “Parameter Missing or Invalid: Required parameter missing or invalid: items” whenever I click the “Add to Cart” button.
I’ve provided the code for the form below — is anyone able to tell me where I’m going wrong? I would really appreciate it.
My Code:
{% form 'product', product %}
{% for variant in product.variants %}
{% endfor %}
{{ form | payment_terms }}
{% endform %}