Add to cart does not hide when one of my variant inventory is zero and error 404 issues ( Updated )

Hi,

For my website, this product - https://blaraorganichouse.ca/products/blara-adult-bathrobe?_pos=2&_sid=1a6cc682f&_ss=r. If you choose any size and color ( need to select both ) other than XL ( I only have XL inventory left, other variant inventory is zero), the add to cart button is still available( It should be grey out and unclickable ) and when I click add to cart, it will show error 404 - Parameter Missing or Invalid: Required parameter missing or invalid: items. Thank you!

The code :


  

    
    

    {% assign current_variant = product.selected_or_first_available_variant %}
	{% assign size_chart_type = '1' %}
	
    
      

        {% include 'magiczoomplus' %}
      

      
        

          {% if section.settings.product_vendor_enable %}
            ## {{ product.vendor }}
          {% endif %}

          # {{ product.title }}
{% comment %}Start automatically added Judge.me widget{% endcomment %}
  {% render 'judgeme_widgets', widget_type: 'judgeme_preview_badge', concierge_install: true, product: product %}
{% comment %}End automatically added Judge.me widget{% endcomment %}

          
            {% comment %}
              Optionally show the 'compare at' or original price of the product.
            {% endcomment %}

            {% if product.compare_at_price_max > product.price %}
              {{ 'products.general.regular_price' | t }}
              
                
                  {% if current_variant.compare_at_price > current_variant.price %}
                    {{ current_variant.compare_at_price | money }}
                  {% endif %}
                
              
              {{ 'products.general.sale_price' | t }}
            {% else %}
              {{ 'products.general.regular_price' | t }}
            {% endif %}

            
              {{ current_variant.price | money }}
            

            

---

            
            

            

          

          
            

			  

                - **DESCRIPTION**

                - **SIZE**

                - **SHIPPING & POLICY**
			  

			  
			  {{ product.description }}
			  

			  
			See the full size guide	
			  
			  

			  
				Free shipping is offered for:  

				Within British Columbia -  orders over $148+ (excluding applicable taxes)

				Across Canada  -  orders over $200+ (excluding applicable taxes)

				

			  	Standard:  	 	Within 7 Business Days for $20

				Express:   	 	 	Within 3 Business Days for $35

				Please note that taxes on shipping charges vary between provinces. Shipping charges and any applicable taxes will be indicated at the time of checkout.

				See our return & exchange policy.
			  

			

          

          {% if section.settings.social_sharing_products %}
            {% include 'social-sharing', share_title: product.title, share_permalink: product.url, share_image: product %}
          {% endif %}
        

      

    

    
    {% if product.type=="SHOES" %}
    
        

    
![how_to_choose_shoes.png?13846113688904162760|1440x380](upload://e4rhUBwFWv2WSILBqJIkfqkbTXK.png)

        

    

      {% endif %}
    
    
{% comment %}Start automatically added Judge.me widget{% endcomment %}
  {% render 'judgeme_widgets', widget_type: 'judgeme_review_widget', concierge_install: true, product: product %}
{% comment %}End automatically added Judge.me widget{% endcomment %}
{% if collection %}
      

---

      
        ← {{ 'products.general.collection_return' | t: collection: collection.title }}
      

    {% endif %}

  

{{ pages.size-chart.content }}

{% unless product.empty == empty %}
  
{% endunless %}

{% schema %}
  {
    "name": "Product pages",
    "settings": [
      {
        "type": "checkbox",
        "id": "zoom_enable",
        "label": "Enable image zoom"
      },
      {
        "type": "checkbox",
        "id": "social_sharing_products",
        "label": "Enable product sharing",
        "default": true
      },
      {
        "type": "checkbox",
        "id": "product_vendor_enable",
        "label": "Show product vendor"
      }
    ]
  }
{% endschema %}

The problem is in your theme.js file. The _onSelectChange/_updateImages functions are failing. There is probably some code there to disable the add to cart button when a product is out of stock, but because those functions are failing it won’t work.

Hi,

Thanks for the reply, is there anyway i can find out which part of my theme.js is not working? i know only some basic coding and been research for hours but still cant solve this.

This error 404 is very hard to solve when I try to access my add to cart button as you can seehere some detail about this issue.