Bold Upsell Fix Free Products From Updating Quantity

bold-upsell-checkout-fix.liquid snippet

Create a snippet named 'bold-upsell-checkout-fix.liquid' and paste the code in the snippet below.
<script>
  document.addEventListener('click', function(event){
    if( (event.target.className.indexOf('bold_clone') === -1 ) &&
       ( ( event.target.name === 'checkout' && event.target.form ) ||
        ( event.target.closest('form') && event.target.closest('[name="checkout"]') ) )
      ){
      event.preventDefault();
      var form = event.target.closest('form');
      var request = new XMLHttpRequest();

      request.onload = function(){
        if( BOLD && BOLD.common && BOLD.common.eventEmitter && typeof BOLD.common.eventEmitter.emit === 'function' ){
          BOLD.common.eventEmitter.emit('BOLD_COMMON_cart_loaded');
        }
        document.location = '/checkout';
      };
      request.open("POST", "/cart/update.js?" + $(form).serialize());
      request.send();
    }
  }); 


</script>
 

include snippet in theme.liquid

include snippet before the end body tag </body> in theme.liquid
{% include 'bold-upsell-checkout-fix' %}

cart.liquid

Open cart.liquid and find this code
<input type="number" class="form-control" name="updates[{{ i.id }}]" id="updates_{{ i.id }}" value="{{ i.quantity }}" min="0"{% if product_max_qty %} max="{{ product_max_qty }}"{% endif %} onfocus="this.select();"/>
and replace with
{% if i.product.tags contains 'DISCOUNT_HIDDEN_PRODUCT' %}
   <input type="number" name="updates[{{ i.id }}]" id="updates_{{ i.id }}" value="{{ i.quantity }}" disabled>
  {% else %}
<input type="number" class="form-control" name="updates[{{ i.id }}]" id="updates_{{ i.id }}" value="{{ i.quantity }}" min="0"{% if product_max_qty %} max="{{ product_max_qty }}"{% endif %} onfocus="this.select();"{{ bold_qty_attr }}/>
  {% endif %}
 

Add product tag

If the product is a duplicate & hide product then your good to go if not then open the free product in the backend of Shopify and add this tag.
DISCOUNT_HIDDEN_PRODUCT