DEV Community

Cover image for How to Edit WooCommerce Checkout Page Without Builder
Istiak Ahamed
Istiak Ahamed

Posted on Originally published at kinetix.software

How to Edit WooCommerce Checkout Page Without Builder

Every unnecessary input field and third-party builder script on a checkout screen directly increases cart abandonment and slows down the /?wc-ajax=update_order_review XHR round-trip. When developers search woocommerce how to edit checkout page, most guides still recommend either a heavy drag-and-drop funnel builder or legacy update_post_meta() snippets that silently fail on stores running High-Performance Order Storage (HPOS). Whether your storefront runs the modern wp:woocommerce/checkout Block or the classic [woocommerce_checkout] shortcode, you can add, remove, reorder, and validate every field in under 80 lines of update-safe PHP.

Table of Contents


Why Page Builders Break Checkout Performance and HPOS

The checkout URL cannot be served from a full-page edge cache. Every visitor hitting /checkout/ has an active wp_woocommerce_session_* cookie and a unique cart hash, forcing PHP and MySQL to assemble the document dynamically on the origin server.

Wrapping that uncached request in a visual page builder introduces three production hazards:

  1. update_order_review latency inflation: Every time a shopper changes their country, state, postal code, or shipping method, wc-checkout.js fires an uncached POST /?wc-ajax=update_order_review request. When a builder hooks dozens of widget filters into init and wp_loaded, that AJAX call climbs from 180 ms to over 900 ms, freezing the payment methods panel behind a translucent white spinner overlay.
  2. Payment gateway iframe detachment: Stripe Payment Elements, PayPal Smart Buttons, and Apple Pay mount secure iframes inside #payment. Visual builder animations, tab wrappers, or custom DOM re-renders frequently destroy and recreate the parent container after updated_checkout fires, leaving the credit card input blank or unclickable.
  3. Broken HPOS storage (wp_wc_orders): Since WooCommerce 8.2+, High-Performance Order Storage stores orders in dedicated tables (wp_wc_orders, wp_wc_order_addresses, wp_wc_orders_meta) rather than wp_posts and wp_postmeta. Outdated checkout field plugins and snippets that call update_post_meta( $order_id, '_vat_number', $val ) write to the wrong table or drop the data completely when compatibility mode is turned off.

Verdict: keep the checkout free of visual builder wrappers. Use WooCommerce's native filter APIs and WC_Order CRUD methods so payment gateways and HPOS tables work without friction.


WooCommerce Checkout Execution and Validation Pipeline

Before modifying fields, verify which checkout engine your store renders and where PHP hooks intercept the request lifecycle. Open the /checkout/ page in the WordPress editor: if it contains the <!-- wp:woocommerce/checkout --> block, it runs the Store API (POST /wp-json/wc/store/v1/checkout). If it contains the [woocommerce_checkout] shortcode (or a woocommerce/classic-shortcode block), it runs the classic WC_Checkout AJAX pipeline.

graph TD
    A[Shopper Loads /checkout/] --> B{Checkout Engine?}
    B -->|Classic Shortcode| C[Filter: woocommerce_checkout_fields]
    C --> D[Render form-checkout.php + Priority Hooks]
    D --> E[Address Change Triggers wc-ajax=update_order_review]
    E --> F[Submit Fires wc-ajax=checkout]
    F --> G[Action: woocommerce_checkout_process Validation]
    G --> H[Action: woocommerce_checkout_create_order HPOS CRUD]
    B -->|Checkout Block| I[woocommerce_register_additional_checkout_field]
    I --> J[React Store API Hydration]
    J --> K[POST /wp-json/wc/store/v1/checkout]
    K --> L[sanitize_callback and validate_callback]
    L --> M[Action: woocommerce_store_api_checkout_update_order_from_request]
    H --> N[Payment Gateway process_payment and Redirect]
    M --> N

Both pipelines converge at the WC_Order object before calling the active payment gateway's process_payment( $order_id ) method.


WooCommerce How to Edit Checkout Page Fields via PHP Hooks

For stores running the classic checkout template (still preferred by stores using specialized B2B payment gateways or multi-carrier freight plugins), the woocommerce_checkout_fields filter controls every input inside the billing, shipping, account, and order groups.

Complete Field Dictionary and Priority Map

Every default field in WC()->checkout()->get_checkout_fields() carries a numeric priority and a CSS layout class (form-row-first for left 50%, form-row-last for right 50%, form-row-wide for 100% width).

Field Key Group Default Priority Default Class Safe to Remove?
billing_first_name billing 10 form-row-first No (Required by most card processors)
billing_last_name billing 20 form-row-last No (Required by most card processors)
billing_company billing 30 form-row-wide Yes (Remove on B2C stores to cut form height)
billing_country billing 40 form-row-wide Only if selling strictly to a single country
billing_address_1 billing 50 form-row-wide Yes for 100% digital/virtual carts only
billing_address_2 billing 60 form-row-wide Yes (Shoppers put apartment numbers in address_1)
billing_city billing 70 form-row-wide Yes for digital/virtual carts only
billing_state billing 80 form-row-wide Driven dynamically by country-select.js locale map
billing_postcode billing 90 form-row-wide Keep for AVS (Address Verification System) card checks
billing_phone billing 100 form-row-wide Make optional unless your courier mandates SMS alerts
billing_email billing 110 form-row-wide Never remove (Required for receipt and account binding)
order_comments order 10 form-row-wide Yes (Removing "Order notes" cuts visual clutter)

Production Must-Use Plugin: Pruning, Reordering and Digital Cart Cleanup

Save this file at wp-content/mu-plugins/kx-checkout-fields.php. Putting checkout logic in a must-use plugin guarantees that a theme update never accidentally restores removed fields or breaks your billing form.

<?php
/**
 * Plugin Name: Kinetix Checkout Field Engineer
 * Description: Prunes high-friction checkout fields, promotes email to priority 5,
 *              and collapses physical address fields for virtual-only carts.
 */

defined( 'ABSPATH' ) || exit;

add_filter( 'woocommerce_checkout_fields', function ( array $fields ): array {
    // 1. Move Email to the very top of the billing form (Priority 5)
    //    so abandoned cart recovery and guest lookup happen first.
    if ( isset( $fields['billing']['billing_email'] ) ) {
        $fields['billing']['billing_email']['priority']    = 5;
        $fields['billing']['billing_email']['class']       = array( 'form-row-wide' );
        $fields['billing']['billing_email']['placeholder'] = __( 'you@company.com', 'kinetix' );
    }

    // 2. Remove unnecessary B2C friction fields.
    unset(
        $fields['billing']['billing_company'],
        $fields['billing']['billing_address_2'],
        $fields['shipping']['shipping_company'],
        $fields['shipping']['shipping_address_2'],
        $fields['order']['order_comments']
    );

    // 3. Make phone optional and place it side-by-side with postcode.
    if ( isset( $fields['billing']['billing_postcode'], $fields['billing']['billing_phone'] ) ) {
        $fields['billing']['billing_postcode']['class'] = array( 'form-row-first' );
        $fields['billing']['billing_phone']['class']    = array( 'form-row-last' );
        $fields['billing']['billing_phone']['required'] = false;
    }

    // 4. If the cart contains ONLY virtual/downloadable items, strip physical address fields
    //    while keeping country and postcode for tax/VAT calculation and Stripe AVS.
    if ( WC()->cart && ! WC()->cart->needs_shipping() ) {
        unset(
            $fields['billing']['billing_address_1'],
            $fields['billing']['billing_city'],
            $fields['billing']['billing_state'],
            $fields['billing']['billing_phone']
        );
    }

    return $fields;
}, 20 );

// Also remove the "Additional Information" heading when order_comments is unset.
add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );
Enter fullscreen mode Exit fullscreen mode

Critical Caveat: Why priority changes on address fields sometimes fail unless you filter woocommerce_default_address_fields

When a shopper switches the country dropdown on the frontend, WooCommerce's address-i18n.js script reads the locale rules returned by WC_Countries::get_country_locale() and re-applies the default priorities and required flags for address_1, city, state, and postcode.

If you change the priority or required status of billing_postcode or billing_state inside woocommerce_checkout_fields and notice it snaps back to its old position as soon as the page finishes loading, apply that change inside woocommerce_default_address_fields instead:

add_filter( 'woocommerce_default_address_fields', function ( array $address_fields ): array {
    if ( isset( $address_fields['address_2'] ) ) {
        unset( $address_fields['address_2'] );
    }
    if ( isset( $address_fields['postcode'] ) ) {
        $address_fields['postcode']['class'] = array( 'form-row-first' );
    }
    return $address_fields;
}, 20 );
Enter fullscreen mode Exit fullscreen mode

Filtering woocommerce_default_address_fields propagates automatically to both billing_* and shipping_* field definitions and updates the localized JSON passed to address-i18n.js.


Adding and Validating Custom Checkout Fields With HPOS CRUD

Suppose you sell B2B software licenses or wholesale hardware and need an optional EU VAT / Tax ID field (_kx_tax_id) that validates format, saves into HPOS (wp_wc_orders_meta), and prints on the customer invoice and admin order screen.

Never write directly to wp_postmeta with update_post_meta( $order_id, ... ). Always hook woocommerce_checkout_create_order, which passes the instantiated WC_Order object before the single database commit runs:

<?php
/**
 * Add, validate, persist (HPOS-safe), and display a custom Tax/VAT ID field.
 */

defined( 'ABSPATH' ) || exit;

// 1. Register the field inside the billing group at priority 35.
add_filter( 'woocommerce_checkout_fields', function ( array $fields ): array {
    $fields['billing']['kx_tax_id'] = array(
        'type'        => 'text',
        'label'       => __( 'VAT / Tax ID (Optional)', 'kinetix' ),
        'placeholder' => __( 'e.g. DE123456789', 'kinetix' ),
        'required'    => false,
        'class'       => array( 'form-row-wide' ),
        'priority'    => 35,
        'clear'       => true,
    );
    return $fields;
}, 25 );

// 2. Server-side validation during checkout submission.
add_action( 'woocommerce_checkout_process', function (): void {
    // WooCommerce core verifies the woocommerce-process-checkout-nonce prior to firing this hook.
    if ( empty( $_POST['kx_tax_id'] ) ) {
        return;
    }

    $tax_id = strtoupper( sanitize_text_field( wp_unslash( $_POST['kx_tax_id'] ) ) );

    // Enforce alphanumeric Tax ID between 8 and 15 characters.
    if ( ! preg_match( '/^[A-Z0-9]{8,15}$/', $tax_id ) ) {
        wc_add_notice(
            __( 'Please enter a valid alphanumeric VAT / Tax ID (8–15 characters, no spaces).', 'kinetix' ),
            'error'
        );
    }
} );

// 3. Persist to HPOS (wp_wc_orders_meta) and legacy tables via WC_Order CRUD.
add_action( 'woocommerce_checkout_create_order', function ( WC_Order $order, array $data ): void {
    if ( ! empty( $_POST['kx_tax_id'] ) ) {
        $tax_id = strtoupper( sanitize_text_field( wp_unslash( $_POST['kx_tax_id'] ) ) );
        $order->update_meta_data( '_kx_tax_id', $tax_id );
    }
}, 10, 2 );

// 4. Display the saved Tax ID inside the WooCommerce Admin Order billing panel.
add_action( 'woocommerce_admin_order_data_after_billing_address', function ( WC_Order $order ): void {
    $tax_id = $order->get_meta( '_kx_tax_id', true );
    if ( $tax_id ) {
        printf(
            '<p><strong>%s:</strong> %s</p>',
            esc_html__( 'VAT / Tax ID', 'kinetix' ),
            esc_html( $tax_id )
        );
    }
} );

// 5. Append to customer confirmation emails.
add_filter( 'woocommerce_email_order_meta_fields', function ( array $fields, bool $sent_to_admin, $order ): array {
    if ( $order instanceof WC_Order ) {
        $tax_id = $order->get_meta( '_kx_tax_id', true );
        if ( $tax_id ) {
            $fields['kx_tax_id'] = array(
                'label' => __( 'VAT / Tax ID', 'kinetix' ),
                'value' => $tax_id,
            );
        }
    }
    return $fields;
}, 10, 3 );
Enter fullscreen mode Exit fullscreen mode

Notice step 3: $order->update_meta_data( '_kx_tax_id', $tax_id ) does not trigger an extra SAVE query on its own. WooCommerce batches all meta changes made during woocommerce_checkout_create_order and commits them in a single transaction when $order->save() executes right after the action completes.

If you are building custom backend interfaces for order metadata or product specs outside WooCommerce, see our companion architectural guides on WordPress custom fields without a plugin and building a WordPress custom meta box without a plugin.


Editing the Modern WooCommerce Checkout Block via PHP API

If your store uses the block-based checkout (wp:woocommerce/checkout), classic filters like woocommerce_checkout_fields do not run because the form is rendered in React and submitted to the Store REST API (/wp-json/wc/store/v1/checkout).

Starting in WooCommerce 8.6+ and expanded in WooCommerce 8.9+, core provides a first-party PHP registration API—woocommerce_register_additional_checkout_field()—that injects custom text, select, or checkbox inputs directly into the Checkout Block, handles client and server validation, and automatically saves the value to the order and customer object.

<?php
/**
 * Register custom fields in the WooCommerce Checkout Block (WC 8.9+).
 */

defined( 'ABSPATH' ) || exit;

add_action( 'woocommerce_init', function (): void {
    if ( ! function_exists( 'woocommerce_register_additional_checkout_field' ) ) {
        return;
    }

    // 1. Text field inside the Contact step ('contact', 'address', or 'order').
    woocommerce_register_additional_checkout_field(
        array(
            'id'                => 'kinetix/tax-id',
            'label'             => __( 'VAT / Tax ID (Optional)', 'kinetix' ),
            'location'          => 'contact',
            'type'              => 'text',
            'required'          => false,
            'attributes'        => array(
                'autocomplete' => 'organization',
                'maxLength'    => 15,
            ),
            'sanitize_callback' => function ( $field_value ) {
                return strtoupper( preg_replace( '/[^A-Za-z0-9]/', '', (string) $field_value ) );
            },
            'validate_callback' => function ( $field_value ) {
                if ( '' !== $field_value && ( strlen( $field_value ) < 8 || strlen( $field_value ) > 15 ) ) {
                    return new WP_Error(
                        'kx_invalid_tax_id',
                        __( 'VAT / Tax ID must be between 8 and 15 alphanumeric characters.', 'kinetix' )
                    );
                }
                return true;
            },
        )
    );

    // 2. Select dropdown inside the Order step ('order').
    woocommerce_register_additional_checkout_field(
        array(
            'id'       => 'kinetix/delivery-window',
            'label'    => __( 'Preferred Delivery Window', 'kinetix' ),
            'location' => 'order',
            'type'     => 'select',
            'required' => false,
            'options'  => array(
                array( 'value' => 'anytime', 'label' => __( 'Standard (8 AM – 6 PM)', 'kinetix' ) ),
                array( 'value' => 'morning', 'label' => __( 'Morning (8 AM – 12 PM)', 'kinetix' ) ),
                array( 'value' => 'evening', 'label' => __( 'Afternoon (12 PM – 6 PM)', 'kinetix' ) ),
            ),
        )
    );
} );
Enter fullscreen mode Exit fullscreen mode

Reading Additional Block Checkout Fields From an Order

Fields registered through woocommerce_register_additional_checkout_field() are stored under the _wc_other/<namespace>/<field> meta key convention and can be retrieved cleanly through the Automattic\WooCommerce\Blocks\Package service container or standard $order->get_meta():

$tax_id = $order->get_meta( '_wc_other/kinetix/tax-id', true );
Enter fullscreen mode Exit fullscreen mode

To toggle built-in block fields (like Company, Apartment/Suite, or Phone) on a block checkout without code, open /checkout/ in the Block Editor, click the Address Fields inner block inside wp:woocommerce/checkout, and toggle the field visibility switches in the right-hand block inspector sidebar.

Deep Dive: Modifying Cart and Order Summary Totals in the Checkout Block via ExtendSchema

When a B2B checkout needs to react dynamically to a custom field value—such as applying a reverse-charge VAT exemption as soon as a valid EU VAT number is entered into kinetix/tax-id—the Checkout Block uses the @woocommerce/blocks-checkout extension API alongside PHP's woocommerce_store_api_checkout_update_order_from_request action.

On the PHP side, hook woocommerce_store_api_checkout_update_order_from_request to inspect the submitted extensions or additional field data on the WC_Order instance, set $order-&gt;update_meta_data( 'is_vat_exempt', 'yes' ), and trigger $order-&gt;calculate_totals(). On the client side, call extensionCartUpdate( { namespace: 'kinetix-tax', data: { tax_id: value } } ) from @wordpress/data (wc/store/cart) whenever the input blurs. That dispatches a lightweight batch request to /wp-json/wc/store/v1/batch and updates the Order Summary tax line item in under 150 milliseconds without reloading the checkout document or resetting the customer's credit card iframe state.


Checkout Layout, Distraction-Free Headers and Script Pruning

learning woocommerce how to edit checkout page is only half the conversion battle; the other half is stripping everything on /checkout/ that does not help the shopper complete payment.

On a block theme (see our blueprint on WordPress custom block theme development), create a dedicated templates/page-checkout.html file that replaces the full navigation bar with a distraction-free header showing only the brand logo and a "Return to Cart" link.

Then strip every non-essential third-party script (chat widgets, social share bars, sliders, lightbox scripts) from /checkout/ so the browser main thread focuses exclusively on payment gateway iframes and address validation:

<?php
/**
 * Dequeue non-essential assets on the WooCommerce checkout page to protect INP.
 */

defined( 'ABSPATH' ) || exit;

add_action( 'wp_enqueue_scripts', function (): void {
    if ( ! function_exists( 'is_checkout' ) || ! is_checkout() ) {
        return;
    }

    // Remove product gallery scripts if a theme accidentally enqueued them globally.
    wp_dequeue_script( 'zoom' );
    wp_dequeue_script( 'flexslider' );
    wp_dequeue_script( 'photoswipe-ui-default' );
    wp_dequeue_style( 'photoswipe-default-skin' );

    // Remove comment-reply and block library styles not needed during payment.
    wp_dequeue_script( 'comment-reply' );
}, 99 );
Enter fullscreen mode Exit fullscreen mode

For a full site-wide asset and wp_options cleanup strategy, pair this snippet with our guide on WordPress speed optimization without a plugin. And if you are optimizing the step right before checkout, apply the same hook-driven discipline in how to edit a WooCommerce product page without a builder.


Benchmarking Checkout Architectures

We benchmarked three checkout setups on identical PHP 8.3 / Redis / Nginx infrastructure with a variable product in the cart (see how to add product variations in WooCommerce) and Stripe Payment Elements enabled:

Performance & Engineering Metric Classic Checkout + PHP Hooks WooCommerce Checkout Block (wc/store/v1) Visual Funnel / Page Builder Checkout
Total DOM Nodes 480 – 650 nodes 520 – 710 nodes 1,650 – 2,900 nodes
Frontend JS Payload (Gzipped) ~48 KB (jQuery + wc-checkout.js) ~135 KB (React runtime + @woocommerce/blocks) ~240 – 410 KB (Builder runtime + jQuery + add-ons)
update_order_review / Cart Update Latency 140 – 210 ms 110 – 175 ms (Batch Store API) 420 – 950 ms
Interaction to Next Paint (INP) 65 – 110 ms 75 – 130 ms 230 – 480 ms
HPOS (wp_wc_orders) Compatibility 100% (via WC_Order CRUD hooks) 100% (Native Store API support) Fragile (Many add-ons still query wp_postmeta)

Kinetix (kinetix.software) is architected around these exact constraints: zero visual-builder lock-in, semantic block templates, and a CSS-variable surface engine that styles both the classic and block checkout with less than 4 KB of scoped CSS. You can review the theme setup in the Kinetix documentation and inspect recent core performance updates in the changelog.


Troubleshooting Checkout Field and AJAX Errors

1. The payment methods section spins infinitely on /?wc-ajax=update_order_review

Open Chrome DevTools $\rightarrow$ Network $\rightarrow$ filter by Fetch/XHR and click the /?wc-ajax=update_order_review request:

  • HTTP 500 or malformed JSON response: A custom action hooked into woocommerce_review_order_before_payment or woocommerce_checkout_update_order_review is echoing stray HTML or throwing a PHP warning before WooCommerce sends wp_send_json(). Check your PHP error log and ensure WP_DEBUG_DISPLAY is set to false on staging/production.
  • ** Session nonce mismatch (-1 response):** Your page cache or CDN is caching /checkout/ or stripping the wp_woocommerce_session_* cookie. Bypass cache on /checkout/*, /cart/*, and any request carrying woocommerce_items_in_cart.

2. Custom fields added via woocommerce_checkout_fields do not show up on the page

Your checkout page is using the WooCommerce Checkout Block (`) rather than the[woocommerce_checkout]shortcode. The Checkout Block ignoreswoocommerce_checkout_fields. Either register your field viawoocommerce_register_additional_checkout_field()onwoocommerce_init` (shown above), or switch the page to the Classic Checkout block if a legacy payment gateway requires classic PHP form hooks.

3. Custom checkout meta saves on guest orders but disappears from the Admin Order screen

Check whether High-Performance Order Storage (HPOS) is active under WooCommerce > Settings > Advanced > Features. If HPOS is enabled and your snippet calls update_post_meta( $order_id, 'my_key', $val ) instead of $order-&gt;update_meta_data( 'my_key', $val ) inside woocommerce_checkout_create_order, the value was written to wp_postmeta while the Admin Order screen reads from wp_wc_orders_meta. Migrate all get_post_meta / update_post_meta calls on order IDs to $order-&gt;get_meta() and $order-&gt;update_meta_data().


Related Content


Originally published at https://kinetix.software/blog/woocommerce-how-to-edit-checkout-page.

Top comments (0)