snave07

form-billing.php

Oct 13th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.99 KB | None | 0 0
  1. <?php
  2. /**
  3. * Checkout billing information form
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-billing.php.
  6. *
  7. * HOWEVER, on occasion WooCommerce will need to update template files and you
  8. * (the theme developer) will need to copy the new files to your theme to
  9. * maintain compatibility. We try to do this as little as possible, but it does
  10. * happen. When this occurs the version of the template file will be bumped and
  11. * the readme will list any important changes.
  12. *
  13. * @see https://docs.woocommerce.com/document/template-structure/
  14. * @package WooCommerce/Templates
  15. * @version 3.6.0
  16. * @global WC_Checkout $checkout
  17. */
  18.  
  19. defined( 'ABSPATH' ) || exit;
  20.  
  21. $thegem_checkout_type = thegem_get_option('checkout_type', 'multi-step');
  22.  
  23.  
  24. ?>
  25. <div class="woocommerce-billing-fields clearfix">
  26. <?php if ( wc_ship_to_billing_address_only() && WC()->cart->needs_shipping() ) : ?>
  27.  
  28. <h2><span class="light"><?php esc_html_e( 'Billing &amp; Shipping', 'woocommerce' ); ?></span></h2>
  29.  
  30. <?php else : ?>
  31.  
  32. <h2><span class="light"><?php esc_html_e( 'Billing details', 'woocommerce' ); ?></span></h2>
  33.  
  34. <?php endif; ?>
  35.  
  36. <?php do_action( 'woocommerce_before_checkout_billing_form', $checkout ); ?>
  37.  
  38. <div class="woocommerce-billing-fields__field-wrapper">
  39. <?php
  40. $fields = $checkout->get_checkout_fields( 'billing' );
  41.  
  42. foreach ( $fields as $key => $field ) {
  43. woocommerce_form_field( $key, $field, $checkout->get_value( $key ) );
  44. }
  45. ?>
  46. </div>
  47.  
  48.  
  49.  
  50. <?php if ( $thegem_checkout_type == 'one-page' && ! is_user_logged_in() && $checkout->is_registration_enabled() ) : ?>
  51. <div class="woocommerce-account-fields">
  52. <?php if ( ! $checkout->is_registration_required() ) : ?>
  53.  
  54. <p class="form-row form-row-wide create-account-checkbox">
  55. <input class="input-checkbox gem-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" />
  56. <label for="createaccount" class="checkbox"><?php _e( 'Create an account?', 'woocommerce' ); ?></label>
  57. </p>
  58.  
  59. <?php endif; ?>
  60.  
  61. <?php do_action( 'woocommerce_before_checkout_registration_form', $checkout ); ?>
  62.  
  63. <?php if ( $checkout->get_checkout_fields( 'account' ) ) : ?>
  64.  
  65. <div class="create-account">
  66. <p class="form-row create-account-notice">
  67. <?php _e( 'Create an account by entering the information below. If you are a returning customer please login at the top of the page.', 'thegem' ); ?>
  68. </p>
  69.  
  70. <?php foreach ( $checkout->get_checkout_fields( 'account' ) as $key => $field ) : ?>
  71. <?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
  72. <?php endforeach; ?>
  73. <div class="clear"></div>
  74. </div>
  75.  
  76. <?php endif; ?>
  77.  
  78. <?php do_action( 'woocommerce_after_checkout_registration_form', $checkout ); ?>
  79. </div>
  80. <?php endif; ?>
  81.  
  82. <?php do_action('woocommerce_after_checkout_billing_form', $checkout ); ?>
  83. </div>
  84.  
  85. <?php if ( $thegem_checkout_type == 'multi-step' && ! is_user_logged_in() && $checkout->is_registration_enabled() ) : ?>
  86. <div class="create-account-popup">
  87. <?php do_action( 'woocommerce_before_checkout_registration_form', $checkout ); ?>
  88.  
  89. <h2><span class="light"><?php _e( 'Register', 'thegem' ); ?></span></h2>
  90.  
  91. <div class="create-account-inner clearfix">
  92. <p class="create-account-notice">
  93. <?php _e( 'Create an account by entering the information below. If you are a returning customer please login at the top of the page.', 'thegem' ); ?>
  94. </p>
  95. <?php if( $checkout->get_checkout_fields( 'account' ) ) : ?>
  96. <?php foreach ( $checkout->get_checkout_fields( 'account' ) as $key => $field ) : ?>
  97. <?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
  98. <?php endforeach; ?>
  99. <?php endif; ?>
  100. <div class="clear"></div>
  101. <div class="create-account-popup-bottom clearfix">
  102. <?php if ( ! $checkout->is_registration_required() ) : ?>
  103. <p class="form-row form-row-wide create-account-checkbox">
  104. <input class="input-checkbox gem-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" /> <label for="createaccount" class="checkbox"><?php esc_html_e( 'Create an account?', 'woocommerce' ); ?></label>
  105. </p>
  106. <?php endif; ?>
  107.  
  108. <?php
  109. thegem_button(array(
  110. 'tag' => 'button',
  111. 'text' => esc_html__( 'Register', 'thegem' ),
  112. 'style' => 'outline',
  113. 'size' => 'medium',
  114. 'extra_class' => 'checkout-create-account-button',
  115. 'attributes' => array(
  116. 'type' => 'button',
  117. )
  118. ), true);
  119. ?>
  120. </div>
  121. </div>
  122.  
  123. <?php do_action( 'woocommerce_after_checkout_registration_form', $checkout ); ?>
  124. </div>
  125. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment