If you’re running a WooCommerce store, you’ve probably encountered the need to edit the checkout page at some point. Maybe you want to add a custom field, change the order of the fields, or remove a field altogether. Whatever the reason, editing the checkout page in WooCommerce is relatively easy to do.
In this article, we’ll show you how to edit the WooCommerce checkout page, both with and without code. We’ll also provide some tips on how to style your checkout page to match the rest of your site.
How to Edit the WooCommerce Checkout Page Without Code
The easiest way to edit the WooCommerce checkout page is by using a plugin.
There are a few different plugins that offer this functionality, but our favorite is WooCommerce Checkout Field Editor.
With WooCommerce Checkout Field Editor, you can add, edit, and delete fields on the checkout page without having to touch any code. You can also reorder fields, add custom sections, and even change the layout of the page itself.
WooCommerce Checkout Field Editor is available as a free plugin on WordPress.org, or as a premium plugin starting at $49 per year.
How to Edit the WooCommerce Checkout Page With Code
If you’re comfortable working with code, you can also edit the WooCommerce checkout page directly. This method gives you more control over your checkout page than using a plugin, but it’s not for everyone.
To edit the WooCommerce checkout page with code, you’ll need to add some code to your child theme’s functions.php file or a custom plugin. We recommend using a child theme so your changes aren’t lost when you update your main theme.
If you’re not comfortable working with code or don’t have a child theme set up yet, check out our guide on how to install a WordPress child theme.
Once you have your child theme set up and activated, open your functions.php file and add the following code:
function my_custom_checkout_fields( $fields ) {
// Add new field after "Order Notes"
$fields['billing']['my_new_field'] = array(
'label' => __( 'My New Field', 'textdomain' ),
'placeholder' => _x( 'Enter value', 'textdomain', 'textdomain' ),
'required' => false,
'class' => array('form-row-wide'),
'clear' => true
);
return $fields; } add_filter( 'woocommerce_checkout_fields', 'my_custom_checkout_fields' );
This code will add a new field after the “Order Notes” field on the checkout page. You can change the label, placeholder text, and CSS class for your new field by editing the values in this code snippet. You can also change where your new field appears on the checkout page by changing its position in the $fields array (billing or shipping).
If you want to remove an existing field from the checkout page instead of adding a new one, you can use this code:
function my_custom_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
return $fields;
}
add_filter( 'woocommerce_checkout_fields', 'my_custom_checkout_fields' );
This code will remove the “First Name” field from the billing section of the checkout form. You can use this same method to remove any other default fields from WooCommerce or fields added by other plugins and themes. Just be sure to change billing_first_name to the correct field name (you can find this in the $fields array).
Once you’ve added or removed all of the fields you want, save your functions.php file and upload it to your server via FTP. Your changes should now be live on your site!
How Do I Style My Custom Checkout Fields?
To style your custom checkout fields, you’ll need to add some CSS to your child theme’s stylesheet (style.css) or a custom CSS plugin like Simple Custom CSS and JS . The exact CSS will vary depending on what theme you’re using and how you want your fields to look, but here’s an example:
.woocommerce-billing-fields__field-wrapper {
display: flex;
flex-direction: column;
}
.form-row input[type="text"], .form-row textarea {
border: 2px solid #333;
padding: 10px;
}
.form-row label {
margin-bottom: 5px;
font-weight: bold;
}
This CSS will make all of your input fields full width and put them below their labels instead of side by side.
It will also add borders and padding around all text inputs and text areas (including those in other sections like shipping). Of course, feel free to experiment with different CSS properties until you get everything looking just right!