| 1 |
<?php |
| 2 |
/** |
| 3 |
* Two step checkout |
| 4 |
* |
| 5 |
* @package |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
$hide_section_settings = \WPFunnels\Wpfnl_functions::get_checkout_section_heading_settings( 'order' , get_the_ID() ); |
| 12 |
$billing_active_cls =''; |
| 13 |
if( is_user_logged_in() ){ |
| 14 |
$billing_active_cls ='current'; |
| 15 |
}else { |
| 16 |
if( 'no' === get_option( 'woocommerce_enable_checkout_login_reminder' ) ){ |
| 17 |
$billing_active_cls ='current'; |
| 18 |
}else{ |
| 19 |
$billing_active_cls =''; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
$get_checkout_fields = get_post_meta(get_the_ID(),'wpfnl_checkout_additional_fields',true); |
| 25 |
$is_order_comments_enable = isset($get_checkout_fields['order_comments']['enable']) ? $get_checkout_fields['order_comments']['enable'] : true; |
| 26 |
?> |
| 27 |
|
| 28 |
<ul class="wpfnl-multistep-wizard"> |
| 29 |
<?php if( ! is_user_logged_in() && 'yes' === get_option( 'woocommerce_enable_checkout_login_reminder' ) ){ ?> |
| 30 |
<li class="login current"> |
| 31 |
<button type="button" data-target="login"> |
| 32 |
<span class="step-icon"> |
| 33 |
<?php include WPFNL_DIR.'public/assets/icons/icon-login.php'; ?> |
| 34 |
</span> |
| 35 |
<span class="step-title"> |
| 36 |
<?php esc_html_e( 'Login', 'wpfnl' ); ?> |
| 37 |
</span> |
| 38 |
</button> |
| 39 |
</li> |
| 40 |
<?php } ?> |
| 41 |
|
| 42 |
<?php if( is_user_logged_in() ){ ?> |
| 43 |
<li class="billing <?php echo $billing_active_cls; ?>"> |
| 44 |
<button type="button" class="two-step" data-target="billing"> |
| 45 |
<span class="step-icon"> |
| 46 |
<?php include WPFNL_DIR.'public/assets/icons/icon-billing.php'; ?> |
| 47 |
</span> |
| 48 |
<span class="step-title"> |
| 49 |
<?php esc_html_e( 'Information', 'wpfnl' ); ?> |
| 50 |
</span> |
| 51 |
</button> |
| 52 |
</li> |
| 53 |
|
| 54 |
<li class="order-review"> |
| 55 |
<button type="button" class="two-step" data-target="order-review"> |
| 56 |
<span class="step-icon"> |
| 57 |
<?php include WPFNL_DIR.'public/assets/icons/icon-order-review.php'; ?> |
| 58 |
</span> |
| 59 |
<span class="step-title"> |
| 60 |
<?php esc_html_e( 'Payment', 'wpfnl' ); ?> |
| 61 |
</span> |
| 62 |
</button> |
| 63 |
</li> |
| 64 |
<?php }else{ |
| 65 |
|
| 66 |
if( ! $checkout->is_registration_required() || 'yes' === get_option( 'woocommerce_enable_checkout_login_reminder' ) || $checkout->is_registration_enabled() ){ |
| 67 |
?> |
| 68 |
<li class="billing <?php echo $billing_active_cls; ?>"> |
| 69 |
<button type="button" class="two-step" data-target="billing"> |
| 70 |
<span class="step-icon"> |
| 71 |
<?php include WPFNL_DIR.'public/assets/icons/icon-billing.php'; ?> |
| 72 |
</span> |
| 73 |
<span class="step-title"> |
| 74 |
<?php esc_html_e( 'Information', 'wpfnl' ); ?> |
| 75 |
</span> |
| 76 |
</button> |
| 77 |
</li> |
| 78 |
|
| 79 |
<li class="order-review"> |
| 80 |
<button type="button" class="two-step" data-target="order-review"> |
| 81 |
<span class="step-icon"> |
| 82 |
<?php include WPFNL_DIR.'public/assets/icons/icon-order-review.php'; ?> |
| 83 |
</span> |
| 84 |
<span class="step-title"> |
| 85 |
<?php esc_html_e( 'Payment', 'wpfnl' ); ?> |
| 86 |
</span> |
| 87 |
</button> |
| 88 |
</li> |
| 89 |
<?php |
| 90 |
} |
| 91 |
} |
| 92 |
?> |
| 93 |
|
| 94 |
</ul> |
| 95 |
|
| 96 |
|
| 97 |
<?php |
| 98 |
do_action( 'woocommerce_before_checkout_form', $checkout ); |
| 99 |
|
| 100 |
|
| 101 |
// If checkout registration is disabled and not logged in, the user cannot checkout. |
| 102 |
if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in() ) { |
| 103 |
echo esc_html( apply_filters( 'woocommerce_checkout_must_be_logged_in_message', __( 'You must be logged in to checkout.', 'wpfnl' ) ) ); |
| 104 |
return; |
| 105 |
} |
| 106 |
|
| 107 |
$loged_in_cls = ''; |
| 108 |
$create_acc_field = ''; |
| 109 |
if( ! is_user_logged_in() && 'yes' === get_option( 'woocommerce_enable_checkout_login_reminder' ) ){ |
| 110 |
$loged_in_cls = ' user-not-logedin '; |
| 111 |
} |
| 112 |
|
| 113 |
if( ! is_user_logged_in() && 'no' === get_option( 'woocommerce_enable_checkout_login_reminder' ) && $checkout->is_registration_required() ){ |
| 114 |
$create_acc_field = ' no-create-acc-field '; |
| 115 |
} |
| 116 |
|
| 117 |
?> |
| 118 |
|
| 119 |
<form name="checkout" method="post" class="checkout woocommerce-checkout <?php echo $loged_in_cls.' '.$create_acc_field; ?>" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data"> |
| 120 |
|
| 121 |
<?php if ( $checkout->get_checkout_fields() ) : ?> |
| 122 |
|
| 123 |
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?> |
| 124 |
|
| 125 |
<div class="col2-set" id="customer_details"> |
| 126 |
<?php |
| 127 |
/** |
| 128 |
* Fires before customer details in checkout page |
| 129 |
* @since 2.8.21 |
| 130 |
*/ |
| 131 |
do_action( 'wpfunnels/before_customer_details' ); |
| 132 |
?> |
| 133 |
<div class="col-1" id="wpfnl_checkout_billing"> |
| 134 |
<?php do_action( 'woocommerce_checkout_billing' ); ?> |
| 135 |
</div> |
| 136 |
|
| 137 |
<div class="col-2" id="wpfnl_checkout_shipping"> |
| 138 |
<?php do_action( 'woocommerce_checkout_shipping' ); ?> |
| 139 |
</div> |
| 140 |
<?php |
| 141 |
/** |
| 142 |
* Fires after customer details in checkout page |
| 143 |
* @since 2.8.21 |
| 144 |
*/ |
| 145 |
do_action( 'wpfunnels/after_customer_details' ); |
| 146 |
?> |
| 147 |
</div> |
| 148 |
|
| 149 |
<?php do_action( 'woocommerce_checkout_after_customer_details' ); ?> |
| 150 |
|
| 151 |
<?php endif; ?> |
| 152 |
|
| 153 |
<?php do_action( 'woocommerce_checkout_before_order_review_heading' ); ?> |
| 154 |
|
| 155 |
<?php do_action( 'woocommerce_checkout_before_order_review' ); ?> |
| 156 |
|
| 157 |
<div id="order_review" class="woocommerce-checkout-review-order"> |
| 158 |
<?php if( !$hide_section_settings || ( isset($hide_section_settings['custom_heading']) && $hide_section_settings['custom_heading'] != '' ) ) { ?> |
| 159 |
<h3 id="order_review_heading"> |
| 160 |
<?php |
| 161 |
if( isset($hide_section_settings['custom_heading']) && $hide_section_settings['custom_heading'] != '' ){ |
| 162 |
esc_html( $hide_section_settings['custom_heading'] ); |
| 163 |
}else{ |
| 164 |
esc_html_e( 'Your order', 'wpfnl' ); |
| 165 |
} |
| 166 |
?> |
| 167 |
</h3> |
| 168 |
<?php } ?> |
| 169 |
|
| 170 |
<?php do_action( 'woocommerce_checkout_order_review' ); ?> |
| 171 |
</div> |
| 172 |
|
| 173 |
<?php do_action( 'woocommerce_checkout_after_order_review' ); ?> |
| 174 |
|
| 175 |
</form> |
| 176 |
|
| 177 |
<div class="wpfnl-multistep-navigation"> |
| 178 |
<button type="button" class="previous btn-default two-step" data-target="" disabled><?php echo __( 'Previous', 'wpfnl' ); ?></button> |
| 179 |
<?php if( !is_user_logged_in() && 'yes' === get_option( 'woocommerce_enable_checkout_login_reminder' ) ){ ?> |
| 180 |
<button type="button" class="next btn-default two-step" data-target="billing"><?php echo __( 'Next', 'wpfnl' ); ?></button> |
| 181 |
<?php }else{ ?> |
| 182 |
<button type="button" class="next btn-default two-step" data-target="order-review"><?php echo __( 'Next', 'wpfnl' ); ?></button> |
| 183 |
<?php } ?> |
| 184 |
</div> |
| 185 |
|
| 186 |
<?php do_action( 'woocommerce_after_checkout_form', $checkout ); ?> |
| 187 |
|