Liquid error (snippets/product-form line 58): product form must be given a product

The collection is showing the following error when clicking “add to cart” on a product that has a variation.

Show More

Liquid error (snippets/product-form line 58): product form must be given a product

On line 58 of the product-form my code is:

{ %- form 'produto' , produto, id : product_form_id, data-productid : product.id, classe : class_frm, novalidate :  'novalidate' , tipo de dado :  'adicionar-ao-carrinho-form' , data-desativar-amostra : isProductDefault -% }

I tried to changing it to:

{ %- formulário produto : produto, id...

but the error changed to:

Show More

Liquid error (snippets/product-form line 58): new_comment form must be given an article

Can some one help me?

Hi @backofficegecom ,

Please send the website link, I will check it for you

What’s your theme?

Can you share entire snippet code?

Given that code references product.id, I’d say that it should rather be

{ %- form 'product' , product, id : product_form_id, data-productid : product.id, classe : class_frm, novalidate :  'novalidate'.... %}

Also, I do not like the tipo de dado : ‘adicionar-ao-carrinho-form’ part – it will generate an error too because parameter name can’t have spaces. I hope they were simply lost when copy-pasting.

Ok, complete snippet code:

{%- assign product_form_id = 'product-form-' | append: pr_se_id -%}
{%- liquid 
assign pr_variants = product.variants
assign PR_buy_pr = false
if bk_stts.show_dynamic_checkout and isExternal == false and isProductAvailable
  assign PR_buy_pr = true 
endif
assign choose_an_option = 'products.product.choose_an_option' | t
assign date_in = settings.date_in
assign class_frm = 't4s-form__product has--form__swatch'
if isProductDefault
  assign class_frm = 't4s-form__product'
endif
if arr_properties.size > 0 and isProductAvailable
    assign class_frm =  class_frm | append: ' has--properties'
endif
if settings.sticky_atc and type == 'main'
  assign class_frm =  class_frm | append:' is--main-sticky'
else if settings.sticky_atc and type == 'main_sticky'
  assign class_frm =  class_frm | append:' is--atc-sticky'
endif

assign color_swatch    = 'disabled-'
assign color_mode      = bk_stts.color_mode
assign selector_mode   = bk_stts.selector_mode
assign stt_color_ck    = settings.color_ck | default:';'
assign color_ck        = stt_color_ck | append:',color,colors,couleur,colour' |remove:';,'
assign get_color       = color_ck | downcase | replace: ' ,', ',' | replace: ', ', ',' | split: ',' | uniq
assign color_mode_list = 'color, color is-sw-cl__round, variant_image, variant_image is-sw-cl__round' |split:', '
if color_mode_list contains color_mode
  assign color_swatch  = 'is-sw__color '
endif
assign current_variant_available = current_variant.available
assign use_incoming_mess = settings.use_incoming_mess
assign current_variant_incoming = false
assign current_inventory_quantity = current_variant.inventory_quantity
if current_inventory_quantity <= 0 and current_variant.inventory_management == 'shopify' and current_variant.incoming
assign current_variant_incoming = true
endif
if pos_sizeg == '1'
    assign html_sizeg = ''
endif
if current_variant.inventory_management != null and current_inventory_quantity > 0 and current_variant.inventory_policy != 'continue'
    assign max_qty = current_inventory_quantity
else
    assign max_qty = 9999
endif
if color_mode contains 'color' or color_mode contains 'variant'
assign show_tooltip = ''
else
assign show_tooltip = '-off'
endif -%}

{%- if color_mode == variant_image or selector_mode == variant_image %}{% endif -%}

  

      
    {%- form 'product', product, id: product_form_id, data-productid: product.id, class: class_frm, novalidate: 'novalidate', data-type: 'add-to-cart-form', data-disable-swatch: isProductDefault -%}
        
        {{- form | payment_terms -}}

        {%- if isProductDefault -%}
          
          {%- if advance_pr_type != blank %}{% render 'choose_style', advance_pr_type:advance_pr_type, title:advance_label, pid:product.id %}{% endif -%}

        {%- else -%}

           {{ 'swatch.css' | asset_url | stylesheet_tag }}
           

          

            
            {%- if advance_pr_type != blank %}{% render 'choose_style', advance_pr_type:advance_pr_type, title:advance_label, pid:product.id %}{% endif -%}
              
            {%- for option in product.options_with_values -%}

              {%- liquid 
              assign option_index   = 'option' | append:forloop.index
              assign selected_value = current_variant[option_index]
              assign option_name    = option.name
              assign name_downcase  = option_name | downcase -%}
              
              {%- if get_color contains name_downcase -%}
                
                

                  #### {{option_name}}: {{selected_value | default:choose_an_option }}{% if name_sizeg == name_downcase %}{{html_sizeg}}{% endif %}
                  
                    {%- if color_mode != variant_image -%}
                      {%- for value in option.values -%}
                      
{{ value }}

                      {%- endfor -%}

                    {%- else -%}
                      
                      

                        

                        
                           {{selected_value | default:choose_an_option }}
                           
                        

                        
                           {%- for value in option.values -%}
                           
{{ value }}

                           {%- endfor -%}
                        

                      

                    {%- endif -%}
                  

                

              {%- else -%}

                
                  #### {{option_name}}: {{selected_value | default:choose_an_option }}{% if name_sizeg == name_downcase %}{{html_sizeg}}{% endif %}
                  
                    {%- if selector_mode != variant_image -%}
                      {%- for value in option.values -%}
                      
{{ value }}

                      {%- endfor -%}

                    {%- else -%}
                      
                      

                        

                        
                           {{selected_value | default:choose_an_option }}
                           
                        

                        
                           {%- for value in option.values -%}
                           
{{ value }}

                           {%- endfor -%}
                        

                      

                    {%- endif -%}
                  

                

              {%- endif -%}

            {%- endfor -%}
          

        {%- endif -%}

        {%- liquid 
        if arr_properties.size > 0 and isProductAvailable
        render 'frm_properties', arr_properties: arr_properties, product: product
        endif -%}

        {%- if use_incoming_mess and current_variant_incoming and pr_variants.size == 1 and current_variant.next_incoming_date != blank -%}
            {%- assign format_date = current_variant.next_incoming_date | date: date_in -%}
            {% if current_variant_available %}{{ 'products.product_single.will_not_ship_until_html' | t: date:format_date }}{% else %}{{ 'products.product_single.will_be_in_stock_after_html' | t: date:format_date }}{% endif %}

        {%- elsif use_incoming_mess and pr_variants.size > 1 -%}
            {%- liquid
            assign format_date = current_variant.next_incoming_date | date: date_in
            unless format_date 
              assign format_date = '19041994'
            endunless -%}
            {{ 'products.product_single.will_not_ship_until_html' | t: date:format_date }}{{ 'products.product_single.will_be_in_stock_after_html' | t: date:format_date }}

        {%- endif -%}
        {{ 'button-style.css' | asset_url | stylesheet_tag }}
        
        
        {{- html_price -}}
    
         
          

             {%- if isExternal -%}

                
                    {%- if bk_stts.btn_icon -%}{%- endif -%}{{external_title}}
                    
                        
                    
                
                {%- if bk_stts.enable_wishlist or bk_stts.enable_compare -%}
                
                {%- render 't4s_wis_cp', product:product, bk_stts:bk_stts -%}
                {%- endif -%}

             {%- else -%}

                {%- if bk_stts.show_qty and isProductAvailable -%}
                
 
                  
                  
                  
                

                {%- else -%}
                 
                {%- endif -%}

                {%- if bk_stts.enable_wishlist or bk_stts.enable_compare -%}
                
                {%- render 't4s_wis_cp', product:product, bk_stts:bk_stts -%}
                {%- endif -%}

                

            {%- endif -%}
          

          {%- if PR_buy_pr and type != 'main_sticky' %}{{- form | payment_button -}}{% endif -%}
          {%- if settings.use_notify_me -%}{%- endif -%}
        

    {%- endform -%}
    {%- unless isProductDefault or type == 'main_sticky' -%}
    
    
    {%- endunless -%}

    {%- if bk_stts.ani != 'none' -%}{%- endif -%}
    
  

 

{%- if PR_buy_pr and current_variant_available != true and type != 'main_sticky' -%}{% endif -%}

This looks proper

{%- form 'product', product, id: product_form_id, data-productid: product.id, class: class_frm, novalidate: 'novalidate', data-type: 'add-to-cart-form', data-disable-swatch: isProductDefault -%}

not sure where you’ve gotten the ‘localized’ code you’ve shared initially…

https://muvucaagroflorestal.com/collections/all