ASTRA_Ext_WooCommerce_Markup::checkout_billing_email_field()
Add Custom Email Field.
Description
Return
(void)
Source
File: addons/woocommerce/classes/class-astra-ext-woocommerce-markup.php
public function checkout_billing_email_field() { $lost_password_url = get_site_url() . '/my-account/lost-password/'; $current_user_name = wp_get_current_user()->display_name; $current_user_email = wp_get_current_user()->user_email; $is_allow_login = 'yes' === get_option( 'woocommerce_enable_checkout_login_reminder' ); ?> <div class="ast-customer-info" id="customer_info"> <div class="ast-customer-info__notice woocommerce-error"></div> <div class="woocommerce-billing-fields-custom"> <h3><?php esc_html_e( apply_filters( 'astra_addon_modern_checkout_customer_info_title', __( 'Customer information', 'astra-addon' ) ) ); // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText ?> <?php if ( ! is_user_logged_in() && $is_allow_login ) { ?> <div class="woocommerce-billing-fields__customer-login-label"><?php /* translators: %1$s: Link HTML start, %2$s Link HTML End */ echo sprintf( __( 'Already have an account? %1$1s Log in%2$2s', 'astra-addon' ), '<a href="javascript:" id="ast-customer-login-url">', '</a>' ); ?></div> <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> <?php } ?> </h3> <div class="woocommerce-billing-fields__customer-info-wrapper"> <?php if ( ! is_user_logged_in() ) { woocommerce_form_field( 'billing_email', array( 'type' => 'email', 'class' => array( 'form-row-fill' ), 'required' => true, 'label' => __( 'Email Address', 'astra-addon' ), 'placeholder' => __( 'Email Address', 'astra-addon' ), 'autocomplete' => 'email username', 'default' => isset( $_COOKIE['ast_modern_checkout_useremail'] ) ? esc_attr( $_COOKIE['ast_modern_checkout_useremail'] ) : '', ) ); if ( 'yes' === get_option( 'woocommerce_enable_checkout_login_reminder' ) ) { ?> <div id="ast-customer-login-section"> <div class="ast-customer-login-inner-wrap"> <?php woocommerce_form_field( 'billing_password', array( 'type' => 'password', 'class' => array( 'form-row-fill', 'ast-password-field' ), 'required' => true, 'label' => __( 'Password', 'astra-addon' ), 'placeholder' => __( 'Password', 'astra-addon' ), ) ); ?> <div class="ast-customer-login-actions"> <?php echo "<input type='button' name='ast-customer-login-btn' class='button ast-customer-login-section__login-button' id='ast-customer-login-section__login-button' value='" . esc_html( __( 'Login', 'astra-addon' ) ) . "'>"; echo "<a href='$lost_password_url' class='ast-customer-login-lost-password-url'>" . esc_html( __( 'Lost your password?', 'astra-addon' ) ) . '</a>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> </div> <?php if ( 'yes' === get_option( 'woocommerce_enable_guest_checkout', false ) ) { echo "<p class='ast-login-section-message'>" . esc_html( __( 'Login is optional, you can continue with your order below.', 'astra-addon' ) ) . '</p>'; } ?> </div> </div> <?php } ?> <?php if ( 'yes' === get_option( 'woocommerce_enable_signup_and_login_from_checkout' ) ) { ?> <div class="ast-create-account-section" hidden> <?php if ( 'yes' === get_option( 'woocommerce_enable_guest_checkout' ) ) { ?> <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" type="checkbox" name="createaccount" value="1" /> <span><?php esc_html_e( 'Create an account?', 'astra-addon' ); ?></span> </label> </p> <?php } ?> <div class="create-account"> <?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) { woocommerce_form_field( 'account_username', array( 'type' => 'text', 'class' => array( 'form-row-fill' ), 'id' => 'account_username', 'required' => true, 'label' => __( 'Account username', 'astra-addon' ), 'placeholder' => __( 'Account username', 'astra-addon' ), ) ); } if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) { woocommerce_form_field( 'account_password', array( 'type' => 'password', 'id' => 'account_password', 'class' => array( 'form-row-fill' ), 'required' => true, 'label' => __( 'Create account password', 'astra-addon' ), 'placeholder' => __( 'Create account password', 'astra-addon' ), ) ); } ?> </div> </div> <?php } ?> <?php } else { ?> <div class="ast-logged-in-customer-info"> <?php /* translators: %1$s: username, %2$s emailid */ echo apply_filters( 'astra_addon_logged_in_customer_info_text', sprintf( __( ' Welcome Back %1$s (%2$s)', 'astra-addon' ), esc_attr( $current_user_name ), esc_attr( $current_user_email ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> <div><input type="hidden" class="ast-email-address" id="billing_email" name="billing_email" value="<?php echo esc_attr( $current_user_email ); ?>"/></div> </div> <?php } ?> </div> </div> </div> <?php }
Expand full source code Collapse full source code View on Trac