<?php /** * Checkout billing information form * * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-billing.php. * * HOWEVER, on occasion WooCommerce will need to update template files and you * (the theme developer) will need to copy the new files to your theme to * maintain compatibility. We try to do this as little as possible, but it does * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * * @see https://woocommerce.com/document/template-structure/ * @package WooCommerce\Templates * @version 3.6.0 * @global WC_Checkout $checkout */ defined('ABSPATH') || exit; $fields = $checkout->get_checkout_fields('billing'); ?> <?php if (!is_user_logged_in() && $checkout->is_registration_enabled()) : ?> <div class="woocommerce-billing-fields woocommerce-billing-fields-top"> <h3><?php esc_html_e('Login', 'woocommerce'); ?></h3> <p>Log in to place your order</p> <div class="woocommerce-billing-fields__field-wrapper"> <?php foreach ($fields as $key => $field) { if ($key === 'billing_email') { woocommerce_form_field($key, $field, $checkout->get_value($key)); } } ?> <p class="form-row form-row-wide" id="billing_password_field" data-priority="110"> <span class="woocommerce-input-wrapper"> <input type="password" class="input-text" name="billing_password" id="billing_password" placeholder="Password"> </span> </p> <div class="flogin-btn"> <button type="button"><?php _e('Login and place order', 'wp'); ?></button> </div> <div class="flogin-footer"> <div>Not yet a member?</div> <div>create an account</div> <div>Create an account and place your order</div> </div> </div> </div> <?php else : ?> <div class="woocommerce-billing-fields"> <h3><?php esc_html_e('Account', 'woocommerce'); ?></h3> <div class="woocommerce-billing-fields__field-wrapper"> <?php foreach ($fields as $key => $field) { if ($key === 'billing_email') { woocommerce_form_field($key, $field, $checkout->get_value($key)); } } ?> </div> </div> <?php endif; ?> <div class="woocommerce-billing-fields"> <?php if (wc_ship_to_billing_address_only() && WC()->cart->needs_shipping()) : ?> <h3><?php esc_html_e('Billing & Shipping', 'woocommerce'); ?></h3> <?php else : ?> <h3><?php esc_html_e('Billing Info', 'woocommerce'); ?></h3> <?php endif; ?> <?php do_action('woocommerce_before_checkout_billing_form', $checkout); ?> <div class="woocommerce-billing-fields__field-wrapper"> <?php foreach ($fields as $key => $field) { if ($key !== 'billing_email') { woocommerce_form_field($key, $field, $checkout->get_value($key)); } } ?> <?php woocommerce_form_field('billing_notes', array( 'type' => 'textarea', 'class' => array('form-row-wide'), 'label' => false, 'placeholder' => __('Order notes(optional)', 'woocommerce'), 'required' => false, ), $checkout->get_value('billing_notes')); ?> <div class="form-row shipping-address-method-field"> <input type="radio" name="shipping-address-method[]" value="billing_address" id="method-billing_address" checked> <label for="method-billing_address">Ship to this address</label> </div> </div> <?php do_action('woocommerce_after_checkout_billing_form', $checkout); ?> </div> <?php if (!is_user_logged_in() && $checkout->is_registration_enabled()) : ?> <div class="woocommerce-account-fields"> <?php if (!$checkout->is_registration_required()) : ?> <p class="form-row form-row-wide create-account"> <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox"> <input class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" id="createaccount" <?php checked((true === $checkout->get_value('createaccount') || (true === apply_filters('woocommerce_create_account_default_checked', false))), true); ?> type="checkbox" name="createaccount" value="1" /> <span><?php esc_html_e('Create an account?', 'woocommerce'); ?></span> </label> </p> <?php endif; ?> <?php do_action('woocommerce_before_checkout_registration_form', $checkout); ?> <?php if ($checkout->get_checkout_fields('account')) : ?> <div class="create-account"> <?php foreach ($checkout->get_checkout_fields('account') as $key => $field) : ?> <?php woocommerce_form_field($key, $field, $checkout->get_value($key)); ?> <?php endforeach; ?> <div class="clear"></div> </div> <?php endif; ?> <?php do_action('woocommerce_after_checkout_registration_form', $checkout); ?> </div> <?php endif; ?>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter