Why Your BigCommerce Custom Form Fields Keep Clearing: A Deep Dive into VAT Number Issues on Checkout

In the dynamic world of e-commerce, ensuring a smooth and reliable customer experience is paramount. One common frustration that can disrupt the checkout process on BigCommerce stores is when custom form fields mysteriously clear their content. A recent discussion in the BigCommerce community highlighted this precise issue, focusing on a VAT number input field that users reported would sometimes remove the entered data, particularly on the checkout page.

The Problem: Disappearing VAT Numbers on BigCommerce Checkout

The original post by Jamie Henville described a scenario where customers entering their VAT number into a custom field would find the content disappearing. Jamie’s developer suspected a JavaScript issue within the theme, potentially exacerbated by specific browsers like Google Chrome. This raised critical questions: Was it a platform bug, a theme conflict, or something else entirely?

Initial Diagnosis and Uncovering the Root Cause

Tanner Brodhagen from Brod Solutions quickly chimed in, initially suggesting a browser autofill issue, especially since the VAT number field was a custom addition to the address section. Upon receiving links to the affected pages (both the ‘create account’ and ‘checkout’ pages), Tanner observed a crucial detail:

  • While the issue was reported on both, it was consistently reproducible on the checkout page.
  • On the checkout page, a custom checkout script was actively converting the VAT number input to "GB" (Great Britain), forcing it to match the VAT Country. This script was inadvertently clearing or overwriting the user’s input.

This pinpointed the problem directly to a custom script interfering with the user’s input, rather than a generic autofill or platform bug.

Comprehensive Solutions and Expert Insights

With the core issue identified, the path to a solution became clearer. Tanner suggested that editing the JavaScript within the checkout.html file would be the necessary fix, even offering to assist directly.

Further elaborating on the problem, Sajid Jameel from Codinative.com provided a more comprehensive breakdown of why form fields might clear their content on BigCommerce checkouts. He outlined three primary culprits:

  1. JavaScript Conflict in the Checkout: A script running on the page could be triggering a re-render or reset of the form, wiping out customer input. This is particularly common with how certain browsers (like Chrome) handle form events.
  2. Browser Autofill Interference: The browser might incorrectly detect the field and attempt to autofill it, overwriting the user's entry. Custom address fields are especially vulnerable as they aren't always recognized as standard fields.
  3. Custom Checkout Script Conflict: Any scripts added to your checkout.html for purposes like address formatting, VAT validation, or country detection can inadvertently clear or overwrite custom fields as a side effect. This was the specific issue identified in Jamie’s case.

Sajid emphasized that this is a known and fixable issue, typically requiring a targeted fix rather than a full theme rebuild. The solution involves reviewing the scripts in checkout.html and either adjusting their logic or adding conditions to protect the custom VAT field from being cleared once a customer has entered a value.

Key Takeaways for BigCommerce Merchants and Developers

This community discussion provides valuable insights for any BigCommerce store owner or developer dealing with disappearing custom form field content:

  • Custom Checkout Scripts are Prime Suspects: If you've implemented custom logic on your checkout page, especially related to address or country validation, scrutinize these scripts first.
  • Inspect checkout.html: The checkout.html file is where many custom modifications reside and is often the source of such conflicts.
  • Targeted Fixes are Possible: You don't always need a major overhaul. A precise adjustment to the conflicting JavaScript can resolve the issue.
  • Browser Behavior Matters: Be mindful of how different browsers handle form events and autofill, as this can exacerbate or reveal underlying script conflicts.

For BigCommerce merchants looking to ensure a seamless checkout experience, understanding these potential pitfalls and knowing where to look for solutions is crucial. If you encounter similar issues, consulting with a BigCommerce development partner can quickly identify and resolve the underlying JavaScript conflicts, safeguarding your customer data and conversion rates.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools