Adding Price to Line Item Properties - Text Box

Highlighted
New Member
2 0 0

Is there any way to add $5 to the cart when the Factory Color Name field has text? Thanks!

 

https://customcarposters.com/collections/chevy/products/chevy-corvette-c6-print?variant=142110293688...

 
<p class="line-item-property__field">
  <label for="factory-color-name">Factory Color Name</label>
  <input id="factory-color-name" type="text" name="properties[Factory Color Name]">
</p>
        
            <script>
              $('input[name="properties[Color]"]').click(function() {
                $('#factory-color-name').val('');
              });
              
              $('#factory-color-name').keyup(function() {
                if ($('#factory-color-name').val().length > 0) {
                $('.color_name').html(": <strong></strong>");
                  $('input[name="properties[Color]"]').prop('checked', false);
                }
              });
              
              $('.product-form-product-color-template').submit(function(e) {
                let factory_color_input = $('input[name="properties[Factory Color Name]"]')
                    if (factory_color_input.val()) {
                      $('input[name="properties[Color]"]').val("")
                    }
            });
            </script>
        
        {% endif %}
0 Likes