Issue with Cart Attribute Input Not Reflecting in Admin Panel

Topic summary

A user is experiencing an issue where cart attribute survey inputs are not consistently appearing in the admin panel.

Technical Context:

  • A survey field has been added to the cart attributes
  • The checkout button is intentionally disabled until the survey field is completed
  • JavaScript validation is implemented to check if text input fields are filled before enabling checkout

The Problem:
Despite the validation logic, survey responses sometimes fail to be recorded or reflected in the system.

Code Implementation:
The provided JavaScript snippet shows:

  • jQuery-based validation monitoring text input fields
  • Event listener on ‘keyup’ to update button state
  • Logic to disable/enable checkout button based on whether all fields are filled
  • Code appears corrupted or improperly formatted in the post

Status:
The user is seeking help to identify the root cause of why inputs are intermittently not being captured, questioning whether the checkout button validation logic might be interfering with data submission.

Summarized with AI on November 13. AI used: claude-sonnet-4-5-20250929.

When I add a survey item in Cart Attribute, sometimes the input result is not reflected. What is the cause?

The checkout button is designed not to proceed unless it is entered.

Is this an effect of this? We are waiting for your answer!

{%- when 'survey' -%}

※○○○○○○○

ーーーーーーーーーーー

$(function () {
  const textFields = $("input[type=text]");
  const checkoutButton = $(".cart__checkout-button");

  updateButtonState();

  textFields.on("keyup", updateButtonState);

  function updateButtonState() {
    let allFieldsFilled = true;

    textFields.each(function () {
      if ($(this).val().trim() === "") {
        allFieldsFilled = false;
        return false; 
      }
    });

    if (allFieldsFilled) {
      checkoutButton.removeAttr("disabled");
    } else {
      checkoutButton.attr("disabled", "disabled");
    }
  }
});
1 Like