| 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://woocommerce.com/document/template-structure/ |
| 14 |
* @package WooCommerce\Templates |
| 15 |
* @version 3.6.0 |
| 16 |
* @global \WC_Checkout $checkout |
| 17 |
*/ |
| 18 |
|
| 19 |
use RadiusTheme\SB\Helpers\Fns; |
| 20 |
use RadiusTheme\SB\Modules\ShopifyCheckout\ShopifyCheckoutFns; |
| 21 |
|
| 22 |
if ( ! defined( 'ABSPATH' ) ) { |
| 23 |
exit; |
| 24 |
} |
| 25 |
|
| 26 |
|
| 27 |
WC()->cart->calculate_totals(); |
| 28 |
|
| 29 |
$checkout = WC()->checkout(); |
| 30 |
|
| 31 |
$is_logged_in = ! ( ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in() ); |
| 32 |
|
| 33 |
Fns::load_template( 'shopify-checkout/shopify-header', [] ); |
| 34 |
$billing = $checkout->get_checkout_fields( 'billing' ); |
| 35 |
|
| 36 |
$customize_billing = false; |
| 37 |
if ( Fns::is_module_active( 'checkout_fields_editor' ) ) { |
| 38 |
global $checkout_editor_settings; // Define global variable. |
| 39 |
$customize_billing = 'on' === ( $checkout_editor_settings['modify_billing_form'] ?? 'off' ); |
| 40 |
} |
| 41 |
// Astra Theme Support. |
| 42 |
if ( class_exists( 'Astra_Woocommerce' ) ) { |
| 43 |
remove_action( 'woocommerce_checkout_billing', [ WC()->checkout(), 'checkout_form_shipping' ] ); |
| 44 |
add_action( 'woocommerce_checkout_shipping', [ WC()->checkout(), 'checkout_form_shipping' ] ); |
| 45 |
} |
| 46 |
do_action( 'rtsb_before_shopify_checkout_form' ); |
| 47 |
?> |
| 48 |
<div class="rtsb-checkout-page-full-width rtsb-shopify-checkout-form-and-summery"> |
| 49 |
|
| 50 |
<div class="shopify-left-side rtsb-sticky-element rtsb-top-spacing-38"> |
| 51 |
<div class="shopify-left-side-wrapper"> |
| 52 |
<div class="rtsb-checkout-summery rtsb-mb-30 rtsb-mobile-element"> |
| 53 |
<div id="order_review_top" class="woocommerce-checkout-review-order rtsb-shopify-order-summery"> |
| 54 |
<?php Fns::load_template( 'shopify-checkout/shopify-coupon-form', [] ); ?> |
| 55 |
</div> |
| 56 |
</div> |
| 57 |
<?php Fns::woocommerce_output_all_notices(); ?> |
| 58 |
<div class="rtsb-checkout-page-form"> |
| 59 |
<?php |
| 60 |
if ( ! $is_logged_in ) { |
| 61 |
woocommerce_checkout_login_form(); |
| 62 |
echo esc_html( apply_filters( 'woocommerce_checkout_must_be_logged_in_message', __( 'You must be logged in to checkout.', 'shopbuilder' ) ) ); |
| 63 |
} else { |
| 64 |
do_action( 'rtsb/before/shopify/checkout/form' ); |
| 65 |
woocommerce_login_form( |
| 66 |
[ |
| 67 |
'message' => esc_html__( 'If you have shopped with us before, please enter your details below. If you are a new customer, please proceed to the Billing section.', 'shopbuilder' ), |
| 68 |
'redirect' => wc_get_checkout_url(), |
| 69 |
'hidden' => true, |
| 70 |
] |
| 71 |
); |
| 72 |
?> |
| 73 |
<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data"> |
| 74 |
<div id="billingAddress" class="rtsb-shopify-address-fields <?php echo esc_attr( ShopifyCheckoutFns::is_maltistep() ? 'multistep' : '' ); ?> active"> |
| 75 |
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?> |
| 76 |
<?php |
| 77 |
if ( ! is_user_logged_in() ) { |
| 78 |
?> |
| 79 |
<span class="rtsb-login-form"> |
| 80 |
<?php |
| 81 |
printf( |
| 82 |
'%s <a href="#" class="showlogin">%s</a>', |
| 83 |
esc_html__( 'Already have an account?', 'shopbuilder' ), |
| 84 |
esc_html__( 'Log in', 'shopbuilder' ) |
| 85 |
); |
| 86 |
?> |
| 87 |
</span> |
| 88 |
<?php |
| 89 |
} |
| 90 |
if ( ! $customize_billing && ! empty( $billing['billing_email'] ) ) { |
| 91 |
?> |
| 92 |
<div class="rtsb-mb-30"> |
| 93 |
<div class="rtsb-shopify-contact-title"> |
| 94 |
<h3><?php ShopifyCheckoutFns::print_text_setting( 'email_field_title', esc_html__( 'Contact', 'shopbuilder' ) ); ?></h3> |
| 95 |
</div> |
| 96 |
<?php |
| 97 |
woocommerce_form_field( 'billing_email', $billing['billing_email'], $checkout->get_value( 'billing_email' ) ); |
| 98 |
unset( $billing['billing_email'] ); |
| 99 |
?> |
| 100 |
</div> |
| 101 |
<?php |
| 102 |
} |
| 103 |
Fns::load_template( |
| 104 |
'shopify-checkout/shopify-billing-fields', |
| 105 |
[ |
| 106 |
'checkout' => $checkout , |
| 107 |
'billing' => $billing , |
| 108 |
] |
| 109 |
); |
| 110 |
if ( true === WC()->cart->needs_shipping_address() ) { |
| 111 |
?> |
| 112 |
</div> |
| 113 |
<div id="shippingAddress" class="rtsb-shopify-shipping-fields rtsb-mb-30 <?php echo esc_attr( ShopifyCheckoutFns::is_maltistep() ? 'multistep' : '' ); ?>"> |
| 114 |
<?php } ?> |
| 115 |
<?php do_action( 'woocommerce_checkout_shipping' ); ?> |
| 116 |
<?php do_action( 'woocommerce_checkout_after_customer_details' ); ?> |
| 117 |
</div> |
| 118 |
<?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) { ?> |
| 119 |
<div id="shippingMethod" class="rtsb-shopify-shipping-method rtsb-mb-30 <?php echo esc_attr( ShopifyCheckoutFns::is_maltistep() ? 'multistep' : '' ); ?>"> |
| 120 |
<?php Fns::load_template( 'shopify-checkout/shopify-shipping-method', [] ); ?> |
| 121 |
</div> |
| 122 |
<?php } ?> |
| 123 |
<div id="makePayment" class="rtsb-shopify-payment-method <?php echo esc_attr( ShopifyCheckoutFns::is_maltistep() ? 'multistep' : '' ); ?>"> |
| 124 |
<h3 class="rtsb-mobile-element"><?php echo esc_html__( 'Order Summery', 'shopbuilder' ); ?></h3> |
| 125 |
<div class="rtsb-checkout-summery rtsb-mb-30 rtsb-mobile-element"> |
| 126 |
<?php do_action( 'woocommerce_checkout_before_order_review' ); ?> |
| 127 |
<div id="order_review_inner" class="woocommerce-checkout-review-order rtsb-shopify-order-summery"> |
| 128 |
<?php Fns::load_template( 'shopify-checkout/shopify-cart-items', [] ); ?> |
| 129 |
<div class="shopify-order-footer"> |
| 130 |
<?php Fns::load_template( 'shopify-checkout/order-review-footer', [] ); ?> |
| 131 |
</div> |
| 132 |
</div> |
| 133 |
<?php do_action( 'woocommerce_checkout_after_order_review' ); ?> |
| 134 |
</div> |
| 135 |
<h3><?php echo esc_html__( 'Payment', 'shopbuilder' ); ?></h3> |
| 136 |
<?php woocommerce_checkout_payment(); ?> |
| 137 |
</div> |
| 138 |
<?php do_action( 'rtsb/after/payment/section/shopify/checkout/form' ); ?> |
| 139 |
</form> |
| 140 |
<?php } ?> |
| 141 |
</div> |
| 142 |
<div class="rtsb-checkout-page-footer"> |
| 143 |
<?php ShopifyCheckoutFns::print_footer_menu(); ?> |
| 144 |
<?php ShopifyCheckoutFns::print_text_setting( 'footer_text' ); ?> |
| 145 |
</div> |
| 146 |
</div> |
| 147 |
</div> |
| 148 |
|
| 149 |
<div class="rtsb-checkout-summery rtsb-xs-none rtsb-sticky-element rtsb-top-spacing-38"> |
| 150 |
<div id="order_review" class="woocommerce-checkout-review-order rtsb-shopify-order-summery"> |
| 151 |
<?php do_action( 'woocommerce_checkout_before_order_review' ); ?> |
| 152 |
<?php Fns::load_template( 'shopify-checkout/shopify-cart-items', [] ); ?> |
| 153 |
<?php Fns::load_template( 'shopify-checkout/shopify-coupon-form', [] ); ?> |
| 154 |
<div class="shopify-order-footer"> |
| 155 |
<?php Fns::load_template( 'shopify-checkout/order-review-footer', [] ); ?> |
| 156 |
</div> |
| 157 |
<div class="shopify-order-review-extra-content"> |
| 158 |
<?php ShopifyCheckoutFns::print_text_setting( 'extra_content' ); ?> |
| 159 |
</div> |
| 160 |
<?php do_action( 'woocommerce_checkout_after_order_review' ); ?> |
| 161 |
</div> |
| 162 |
|
| 163 |
</div> |
| 164 |
|
| 165 |
</div> |
| 166 |
|
| 167 |
<?php do_action( 'rtsb_after_shopify_checkout_form' ); ?> |
| 168 |
|
| 169 |
<?php Fns::load_template( 'shopify-checkout/shopify-footer', [] ); ?> |
| 170 |
|