← All changes
|
includes/elementor/modules/checkout/classes/multi-step.php
+53
-19
1.5.1
→
2.7.0
View file →
| @@ -13,8 +13,16 @@ | ||
| 13 | 13 | * @since 1.1.0 |
| 14 | 14 | */ |
| 15 | 15 | class Multi_Step { |
| 16 | 16 | /** |
| 17 | + * Checkout widget settings. | |
| 18 | + * | |
| 19 | + * @since 1.8.6 | |
| 20 | + * @var array | |
| 21 | + */ | |
| 22 | + public $settings; | |
| 23 | + | |
| 24 | + /** | |
| 17 | 25 | * Class construct. |
| 18 | 26 | * |
| 19 | 27 | * @param array $settings widget settings. |
| 20 | 28 | */ |
| @@ -34,9 +42,9 @@ | ||
| 34 | 42 | add_action( 'sellkit-checkout-widget-step-two-header', [ $this, 'step_two_preview_box' ] ); |
| 35 | 43 | } |
| 36 | 44 | |
| 37 | 45 | /* Step 3 wrap. */ |
| 38 | - add_action( 'sellkit-checkout-step-c-begins', [ $this, 'third_step_begin' ] ); | |
| 46 | + add_action( 'sellkit-checkout-step-c-begins', [ $this, 'third_step_begin' ], 5 ); | |
| 39 | 47 | add_action( 'sellkit-checkout-multistep-third-step-back-btn', [ $this, 'third_step_back_btn' ] ); |
| 40 | 48 | add_action( 'sellkit-checkout-step-c-ends', [ $this, 'third_step_ends' ] ); |
| 41 | 49 | // Step 3 preview box. |
| 42 | 50 | if ( 'yes' === $this->settings['show_preview_box'] ) { |
| @@ -44,10 +52,17 @@ | ||
| 44 | 52 | } |
| 45 | 53 | |
| 46 | 54 | // Remove payment method from order review & attach it to step 3. |
| 47 | 55 | remove_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20 ); |
| 48 | - add_action( 'sellkit-checkout-step-c-begins', 'woocommerce_checkout_payment' ); | |
| 56 | + add_action( 'sellkit-checkout-step-c-begins', 'woocommerce_checkout_payment', 20 ); | |
| 49 | 57 | |
| 58 | + $shipping_destination = get_option( 'woocommerce_ship_to_destination', true ); | |
| 59 | + | |
| 60 | + if ( 'billing_only' !== $shipping_destination ) { | |
| 61 | + remove_action( 'woocommerce_checkout_billing', [ WC()->checkout(), 'checkout_form_billing' ] ); | |
| 62 | + add_action( 'sellkit-checkout-step-c-begins', [ WC()->checkout(), 'checkout_form_billing' ], 10 ); | |
| 63 | + } | |
| 64 | + | |
| 50 | 65 | // Sidebar order-review wrap. |
| 51 | 66 | add_action( 'sellkit-checkout-multistep-sidebar-begins', [ $this, 'sidebar_starts' ], 10 ); |
| 52 | 67 | add_action( 'sellkit-checkout-multistep-sidebar-ends', [ $this, 'sidebar_ends' ] ); |
| 53 | 68 | |
| @@ -92,9 +107,9 @@ | ||
| 92 | 107 | if ( 'yes' !== $this->settings['show_shipping_method'] ) { |
| 93 | 108 | $text = esc_html__( 'Continue to payment', 'sellkit' ); |
| 94 | 109 | } |
| 95 | 110 | |
| 96 | - echo $text; | |
| 111 | + echo esc_html( $text ); | |
| 97 | 112 | ?> |
| 98 | 113 | </span> |
| 99 | 114 | </div> |
| 100 | 115 | <?php endif; ?> |
| @@ -126,9 +141,9 @@ | ||
| 126 | 141 | public function second_step_ends() { |
| 127 | 142 | ?> |
| 128 | 143 | <section class="sellkit-multistep-checkout-second-footer"> |
| 129 | 144 | <span class="go-to-first sellkit-checkout-widget-return-button"> |
| 130 | - <i class="fa fa-chevron-left"></i> | |
| 145 | + <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"/></svg> | |
| 131 | 146 | <span><?php echo esc_html__( 'Return to previous step', 'sellkit' ); ?></span> |
| 132 | 147 | </span> |
| 133 | 148 | <span class="go-to-payment sellkit-checkout-widget-primary-button"> |
| 134 | 149 | <?php echo esc_html__( 'Continue to Payment', 'sellkit' ); ?> |
| @@ -165,9 +180,9 @@ | ||
| 165 | 180 | } |
| 166 | 181 | |
| 167 | 182 | ?> |
| 168 | 183 | <span class="go-to-second sellkit-checkout-widget-return-button"> |
| 169 | - <i class="fa fa-chevron-left"></i> | |
| 184 | + <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"/></svg> | |
| 170 | 185 | <span><?php echo esc_html__( 'Return to previous step', 'sellkit' ); ?></span> |
| 171 | 186 | </span> |
| 172 | 187 | <?php |
| 173 | 188 | } |
| @@ -202,13 +217,28 @@ | ||
| 202 | 217 | $class .= ' sellkit-multistep-checkout-sidebar-sticky'; |
| 203 | 218 | } |
| 204 | 219 | ?> |
| 205 | 220 | <div class="sellkit-checkout-right-column"> |
| 206 | - <div id="sellkit-checkout-widget-sidebar" class="<?php echo $class; ?>"> | |
| 221 | + <div id="sellkit-checkout-widget-sidebar" class="<?php echo esc_attr( $class ); ?>"> | |
| 207 | 222 | <div class="summary_toggle"> |
| 208 | - <span class="icon"><i class="fa fa-shopping-cart" aria-hidden="true"></i></span> | |
| 223 | + <span class="summery_toggle_link_wrapper"> | |
| 224 | + <span class="icon sellkit-checkout-summary-toggle-shop-icon"> | |
| 225 | + <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 576 512"> | |
| 226 | + <path d="M0 24C0 10.7 10.7 0 24 0H69.5c22 0 41.5 12.8 50.6 32h411c26.3 0 45.5 25 38.6 50.4l-41 152.3c-8.5 31.4-37 53.3-69.5 53.3H170.7l5.4 28.5c2.2 11.3 12.1 19.5 23.6 19.5H488c13.3 0 24 10.7 24 24s-10.7 24-24 24H199.7c-34.6 0-64.3-24.6-70.7-58.5L77.4 54.5c-.7-3.8-4-6.5-7.9-6.5H24C10.7 48 0 37.3 0 24zM128 464a48 48 0 1 1 96 0 48 48 0 1 1 -96 0zm336-48a48 48 0 1 1 0 96 48 48 0 1 1 0-96z"/> | |
| 227 | + </svg> | |
| 228 | + </span> | |
| 209 | 229 | <span class="title sellkit-checkout-widget-links"><?php echo esc_html__( 'Hide order summary', 'sellkit' ); ?></span> |
| 210 | - <i class="fa fa-3px fa-chevron-up sellkit-checkout-widget-links" style="font-size: 13px; color:#007bff"></i> | |
| 230 | + <span class="sellkit-checkout-widget-links sellkit-checkout-summary-toggle-up"> | |
| 231 | + <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"> | |
| 232 | + <path d="M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z"/> | |
| 233 | + </svg> | |
| 234 | + </span> | |
| 235 | + <span class="sellkit-checkout-widget-links sellkit-checkout-summary-toggle-down"> | |
| 236 | + <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"> | |
| 237 | + <path d="M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"/> | |
| 238 | + </svg> | |
| 239 | + </span> | |
| 240 | + </span> | |
| 211 | 241 | <span class="price"><?php wc_cart_totals_order_total_html(); ?></span> |
| 212 | 242 | </div> |
| 213 | 243 | <?php |
| 214 | 244 | } |
| @@ -232,29 +262,29 @@ | ||
| 232 | 262 | * @return void |
| 233 | 263 | * @since 1.1.0 |
| 234 | 264 | */ |
| 235 | 265 | public function checkout_breadcrumb_desktop() { |
| 236 | - $font = 'fa'; | |
| 237 | - if ( Elementor::$instance->editor->is_edit_mode() ) { | |
| 238 | - $font = 'fas'; | |
| 266 | + if ( ! WC()->cart->needs_shipping() ) { | |
| 267 | + return; | |
| 239 | 268 | } |
| 269 | + | |
| 240 | 270 | ?> |
| 241 | 271 | <section id="checkout-widget-breadcrumb" class="sellkit-checkout-widget-breadcrumb-desktop sellkit-checkout-widget-breadcrumb"> |
| 242 | 272 | <span class="cart blue-line"> |
| 243 | - <a href="<?php echo wc_get_cart_url(); ?>" > | |
| 273 | + <a href="<?php echo esc_url( wc_get_cart_url() ); ?>" > | |
| 244 | 274 | <?php echo esc_html__( 'Cart', 'sellkit' ); ?> |
| 245 | 275 | </a> |
| 246 | 276 | </span> |
| 247 | 277 | |
| 248 | - <i class="<?php echo $font; ?> fa-chevron-right sellkit-checkout-widget-bc-icon"></i> | |
| 278 | + <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"/></svg> | |
| 249 | 279 | <span class="information current"><?php echo esc_html__( 'Information', 'sellkit' ); ?></span> |
| 250 | 280 | |
| 251 | 281 | <?php if ( 'yes' === $this->settings['show_shipping_method'] ) : ?> |
| 252 | - <i class="<?php echo $font; ?> fa-chevron-right sellkit-checkout-widget-bc-icon"></i> | |
| 282 | + <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"/></svg> | |
| 253 | 283 | <span class="shipping inactive"><?php echo esc_html__( 'Shipping', 'sellkit' ); ?></span> |
| 254 | 284 | <?php endif; ?> |
| 255 | 285 | |
| 256 | - <i class="<?php echo $font; ?> fa-chevron-right sellkit-checkout-widget-bc-icon"></i> | |
| 286 | + <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"/></svg> | |
| 257 | 287 | <span class="payment inactive"><?php echo esc_html__( 'Payment', 'sellkit' ); ?></span> |
| 258 | 288 | </section> |
| 259 | 289 | <?php |
| 260 | 290 | } |
| @@ -265,26 +295,30 @@ | ||
| 265 | 295 | * @return void |
| 266 | 296 | * @since 1.1.0 |
| 267 | 297 | */ |
| 268 | 298 | public function checkout_breadcrumb_mobile() { |
| 299 | + if ( ! WC()->cart->needs_shipping() ) { | |
| 300 | + return; | |
| 301 | + } | |
| 302 | + | |
| 269 | 303 | ?> |
| 270 | 304 | <section id="checkout-widget-breadcrumb" class="sellkit-checkout-widget-breadcrumb-mobile sellkit-checkout-widget-breadcrumb"> |
| 271 | 305 | |
| 272 | 306 | <span class="cart"> |
| 273 | - <a href="<?php echo wc_get_cart_url(); ?>" class="blue-line" > | |
| 307 | + <a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class="blue-line" > | |
| 274 | 308 | <?php echo esc_html__( 'Cart', 'sellkit' ); ?> |
| 275 | 309 | </a> |
| 276 | 310 | </span> |
| 277 | 311 | |
| 278 | - <i class="fa fa-chevron-right sellkit-checkout-widget-bc-icon" aria-hidden="true"></i> | |
| 312 | + <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"/></svg> | |
| 279 | 313 | <span class="information current"><?php echo esc_html__( 'Information', 'sellkit' ); ?></span> |
| 280 | 314 | |
| 281 | 315 | <?php if ( 'yes' === $this->settings['show_shipping_method'] ) : ?> |
| 282 | - <i class="fa fa-chevron-right sellkit-checkout-widget-bc-icon" aria-hidden="true"></i> | |
| 316 | + <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"/></svg> | |
| 283 | 317 | <span class="shipping inactive"><?php echo esc_html__( 'Shipping', 'sellkit' ); ?></span> |
| 284 | 318 | <?php endif; ?> |
| 285 | 319 | |
| 286 | - <i class="fa fa-chevron-right sellkit-checkout-widget-bc-icon" aria-hidden="true"></i> | |
| 320 | + <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"/></svg> | |
| 287 | 321 | <span class="payment inactive"><?php echo esc_html__( 'Payment', 'sellkit' ); ?></span> |
| 288 | 322 | </section> |
| 289 | 323 | <?php |
| 290 | 324 | } |