0

I have set up a virtual product store in Magento 2.4, where I do not require users to fill in address information during purchase. How can I remove the required fields from the checkout page address and disable server-side validation of address fields before submitting the order? Please provide instructions on how to disable this validation."

Who can help me? Thank you very much!

5
  • If your quote is virtual, it will not require the shipping address. But, it will require billing address. Please, what are fields you want to remove validation? I think you can search "disable required field validator checkout magento 2" and you will see some answers. Commented May 26, 2023 at 3:59
  • I need to delete First Name, Last Name ,Street Address , Zip/Postal Code, Country State/Province
    – sq y
    Commented May 26, 2023 at 4:05
  • I've hidden the shipping adress, firstbname lastname fields on the front end, but the back end still needs to validate when I click place orderd. How do I get around this verification? I do not want to change the required properties of the fields in the property sheet, because my other payment method requires required fields, and the other payment method does not require required fields
    – sq y
    Commented May 26, 2023 at 4:05
  • Please check your product is virtual product or not. Commented May 26, 2023 at 4:11
  • Yes, it's a virtual product
    – sq y
    Commented May 26, 2023 at 4:14

1 Answer 1

0

Try these all step they will usefull for you

  1. Override the checkout layout file:

In your custom theme or module, create the following directory path if it doesn't exist:

app/design/frontend/[Vendor]/[Theme]/Magento_Checkout/layout

Create a file named checkout_index_index.xml in the above directory.

  1. Edit the checkout_index_index.xml file and add the following code to remove the required attribute from the address fields.

    false
  2. Save the file and clear the Magento cache.

After making these changes, the address fields on the checkout page should no longer be marked as required.

Please note that modifying core files directly is not recommended, so it's always better to use a custom theme or module to override the necessary files and make these changes.

HOPE THIS IS USEFUL TO YOU

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.