Liquid error (sections/template-product ): new_comment form must be given an article

Solved

Liquid error (sections/template-product ): new_comment form must be given an article

nirdoshyaqin
Shopify Partner
10 1 3

Hello.

Kindly forgive me for a basic question, but I have a question about {% form 'product' %}.

In order to make the "buy button" dynamic on the product detail page (corresponding template: product.json, template-product.liquid)
I inserted the following code,

  {% form 'product' product %}
          <input
            type="submit"
            class="flex w-full items-center justify-center rounded-md border border-transparent bg-indigo-600 py-3 px-8 text-base font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 focus:ring-offset-gray-50"
            value="購入する"
          >
        {% endform %}

In spite of loading template-product, as in the following page,

https://tailwind-ui.myshopify.com/products/leatherbound-daily-journal
(you can see the page link above with password of awstaw)

I've got the Liquid error (sections/template-product line 181): new_comment form must be given an article. I guess that this error is displayed in article template, but the error is shown in product template. I don't know why, and  {% form 'product' product %} is not working at all, only showing the error : new_comment form must be given an article.

Have anybody encounter such a strange error, and know how to fix it ?

The below is the URL of the github repository that contains the code of the above theme as it is.

https://github.com/nirdoshyaqin/shopify_tailwind



Thanks in advance,

Accepted Solution (1)

g33kgirl
Shopify Partner
390 109 143

This is an accepted solution.

Hi @nirdoshyaqin,

 

You have missed a comma. The correct syntax is:

 

{% form 'product', product %}
If you found my answer helpful, please LIKE and ACCEPT.
buymeacoffee.com/g33kgirl
If you're not comfortable with code, please modify code files at your own risk.

View solution in original post

Reply 1 (1)

g33kgirl
Shopify Partner
390 109 143

This is an accepted solution.

Hi @nirdoshyaqin,

 

You have missed a comma. The correct syntax is:

 

{% form 'product', product %}
If you found my answer helpful, please LIKE and ACCEPT.
buymeacoffee.com/g33kgirl
If you're not comfortable with code, please modify code files at your own risk.