WooCommerce Custom Checkout Fields: Edit,Delete Fields and Email

by Owais Alam  February 7, 2017

WooCommerce is, without any doubt, a very powerful ecommerce plugin for WordPress. It is capable enough to setup and manage successful ecommerce store of sizable proportions.

WooCommerce Custom Checkout Fields

In my previous article, I covered How to add additional custom fields into WooCommerce checkout page. In this tutorial, I will continue the topic and explain how you could dynamically customize additional fields such as removing the billing address, add/edit custom checkout fields and save these custom fields to the database. I will also discuss how you could add these custom fields to order emails.

Remove Billing Address of WooCommerce Custom Checkout Fields

Remove Billing Address of WooCommerce Custom Checkout Fields

The following code removes the address fields from the billing screen.

Add this code snippet to the functions.php, located in the theme folder of the WordPress website.

theme folder of the WordPress website

Addition of WooCommerce Custom Checkout Field

The following code will add a field to the checkout page, saves the data to the order meta and displays the order meta in the orders admin. I received several queries about the process of adding multiple fields. To help address the issue, this code snippet has been modified to add two fields.

Save the Data of Custom Checkout WooCommerce Fields

Display  the Data of  WooCommerce Custom Fields to User

Input text field

Display the Data of  WooCommerce Custom Fields In Admin

This code snippet will function as the shipping and billing address data and reveal inputs when the user clicks the little pencil icon.

additional information

Add WooCommerce Custom Fields to Order Emails

If you wish to customise the output in the emails,  you can add some text to any of the hooks available in the email templates.

Billing address

Conclusion

In this tutorial, I demonstrated how you could you add, edit and save custom fields to the WooCommerce checkout page. I also added code to edit the email templates to add the information from the custom fields to the emails. If you face any issues with the code or would like to contribute to the discussion, do leave a comment below.

 

Start Creating Web Apps on Managed Cloud Servers Now!

Easy Web App Deployment for Agencies, Developers and E-Commerce Industry

About Owais Alam

is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform and a seasoned PHP developer. He loves to develop all sorts of websites on WordPress and is in love with WooCommerce in particular. You can email him at owais.alam@cloudways.com

Stay Connected:

You Might Also Like...