PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.7.0
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.7.0
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
← All changes | includes/elementor/modules/checkout/classes/local-hooks.php +237 -40 1.6.52.7.0 View file →
@@ -6,8 +6,9 @@
6 6
7 7 use Sellkit\Elementor\Modules\Checkout\Classes\{ Helper, Global_Hooks };
8 8 use Elementor\Plugin as Elementor;
9 9 use Sellkit_Funnel;
10 +use Sellkit\Global_Checkout\Checkout;
10 11
11 12 /**
12 13 * Local hooks.
13 14 * Applies before widget.
@@ -15,12 +16,44 @@
15 16 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
16 17 * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
17 18 * @SuppressWarnings(PHPMD.TooManyMethods)
18 19 * @SuppressWarnings(PHPMD.NPathComplexity)
20 + * @SuppressWarnings(PHPMD.CyclomaticComplexity)
19 21 * @since 1.1.0
20 22 */
21 23 class Local_Hooks {
22 24 /**
25 + * Checkout widget settings.
26 + *
27 + * @since 1.8.6
28 + * @var array
29 + */
30 + public $settings;
31 +
32 + /**
33 + * Checkout widget.
34 + *
35 + * @since 1.8.6
36 + * @var object
37 + */
38 + public $widget;
39 +
40 + /** Array of added products to cart.
41 + *
42 + * @since 1.7.9
43 + * @var array
44 + */
45 + public static $in_cart = [];
46 +
47 + /**
48 + * Checks if bumps applied.
49 + *
50 + * @since 1.8.1
51 + * @var bool
52 + */
53 + public static $is_bumps_applied = false;
54 +
55 + /**
23 56 * Create instance of class without construct.
24 57 *
25 58 * @since 1.1.0
26 59 * @return object
@@ -106,8 +139,11 @@
106 139 add_action( 'sellkit_checkout_required_hidden_fields', [ $this, 'add_trigger_field_for_upsell_steps' ] );
107 140
108 141 // Add upsell templates at the end of page.
109 142 add_action( 'wp_footer', [ $this, 'sellkit_funnel_display_upsell_as_popup' ] );
143 +
144 + // Add order notes to checkout form to desired location.
145 + add_action( 'sellkit_checkout_after_term_and_condition', [ $this, 'order_notes' ] );
110 146 }
111 147
112 148 /**
113 149 * Opens a wrapper around widget checkout form.
@@ -310,9 +346,9 @@
310 346 $class = '\Sellkit\Elementor\Modules\Checkout\Fields\\' . ucfirst( $class );
311 347 $class = new $class();
312 348 $field = '';
313 349
314 - $class->final_html_structure( $field, $details, $key );
350 + $class->final_html_structure( $field, $details, $key, $checkout->get_value( $key ) );
315 351 }
316 352 }
317 353
318 354 /**
@@ -324,12 +360,13 @@
324 360 */
325 361 public function customize_billing_field( $default_fields ) {
326 362 $widget_billing_fields = $this->settings['billing_list'];
327 363 $widget_field_slug = Helper::instance()->get_user_defined_fields_slug( $widget_billing_fields, 'billing_list_field' );
364 + $core_billing_fields = array_keys( Helper::instance()->billing_fields() );
328 365
329 366 // Unset default fields.
330 367 foreach ( $default_fields as $key => $field ) {
331 - if ( ! in_array( $key, $widget_field_slug, true ) && 'billing_email' !== $field ) {
368 + if ( in_array( $key, $core_billing_fields, true ) && ! in_array( $key, $widget_field_slug, true ) && 'billing_email' !== $key ) {
332 369 unset( $default_fields[ $key ] );
333 370 }
334 371 }
335 372
@@ -398,9 +435,9 @@
398 435 $class = '\Sellkit\Elementor\Modules\Checkout\Fields\\' . ucfirst( $class );
399 436 $class = new $class();
400 437 $field = '';
401 438
402 - $field = $class->final_html_structure( $field, $details, $key );
439 + $field = $class->final_html_structure( $field, $details, $key, $checkout->get_value( $key ) );
403 440 }
404 441 }
405 442
406 443 /**
@@ -491,9 +528,9 @@
491 528 ?>
492 529 <section class="sellkit-checkout-widget-express-checkout sellkit-checkout-express-checkout-step-1">
493 530 <fieldset class="express-box sellkit-checkout-widget-divider">
494 531 <legend class="sellkit-express-checkout-legend heading">
495 - <?php echo __( 'Express Checkout', 'sellkit' ); ?>
532 + <?php echo esc_html__( 'Express Checkout', 'sellkit' ); ?>
496 533 </legend>
497 534 <div class="express-methods">
498 535 <?php do_action( 'sellkit-checkout-widget-express-methods' ); ?>
499 536 </div>
@@ -500,15 +537,15 @@
500 537 </fieldset>
501 538 </section>
502 539 <section class="sellkit-checkout-widget-express-checkout sellkit-checkout-express-checkout-step-2">
503 540 <fieldset id="sellkit-checkout-or-divider" class="divider-box sellkit-checkout-widget-divider">
504 - <legend class="heading"><?php echo __( 'OR', 'sellkit' ); ?></legend>
541 + <legend class="heading"><?php echo esc_html__( 'OR', 'sellkit' ); ?></legend>
505 542 </fieldset>
506 543 </section>
507 544 <?php
508 545 $express = ob_get_clean();
509 546 $express = apply_filters( 'sellkit-checkout-widget-express-checkout', $express );
510 - echo $express;
547 + echo wp_kses_post( $express );
511 548 }
512 549
513 550 /**
514 551 * Apply custom Messages.
@@ -528,9 +565,9 @@
528 565 add_action( 'sellkit_core/widgets/checkout/custom_message/create_website_account', function() {
529 566 $site = get_bloginfo( 'name' );
530 567 $text = $this->settings['create_website_account'];
531 568
532 - echo str_replace( '{{website}}', $site, $text );
569 + echo wp_kses_post( str_replace( '{{website}}', $site, $text ) );
533 570 } );
534 571
535 572 add_filter( 'sellkit_core/widgets/checkout/custom_message/secure_transaction_text', function() {
536 573 return $this->settings['secure_transaction_text'];
@@ -566,8 +603,23 @@
566 603 add_action( 'sellkit-checkout-widget-custom-coupon-form', function() use ( $settings ) {
567 604 Global_Hooks::instance()->coupon_form( $settings );
568 605 } );
569 606
607 + // Improve UI issue in the editor for the order summary input.
608 + add_filter( 'woocommerce_cart_item_class', function( $default ) use ( $settings, $posted_data ) {
609 + $default = str_replace( 'product-title-one-row', '', $default );
610 +
611 + if (
612 + ! array_key_exists( 'show_cart_edit', $settings ) ||
613 + array_key_exists( 'bundle-products-force', $posted_data ) ||
614 + empty( $settings['show_cart_edit'] )
615 + ) {
616 + $default .= ' product-title-one-row';
617 + }
618 +
619 + return $default;
620 + } );
621 +
570 622 return;
571 623 }
572 624
573 625 if ( wp_doing_ajax() ) {
@@ -589,9 +641,13 @@
589 641 } );
590 642
591 643 // Disable order item quantity input.
592 644 if ( array_key_exists( 'show_cart_edit', $settings ) || array_key_exists( 'bundle-products-force', $posted_data ) ) {
593 - add_action( 'sellkit-checkout-widget-disable-quantity', [ Helper::instance(), 'checkout_order_hidden_quantity' ], 10, 2 );
645 + add_filter( 'sellkit-checkout-widget-disable-quantity', [ Helper::instance(), 'checkout_order_hidden_quantity' ], 10, 2 );
646 +
647 + add_filter( 'woocommerce_cart_item_class', function( $default ) {
648 + return $default . ' product-title-one-row';
649 + } );
594 650 }
595 651
596 652 add_filter( 'woocommerce_shipping_package_name', function() {
597 653 return '<h4 id="shipping_header_title" class="shipping-method-header heading">' . esc_html__( 'Shipping Methods', 'sellkit' ) . '</h4>';
@@ -638,9 +694,9 @@
638 694 }, 10 );
639 695
640 696 // Disable order item quantity input.
641 697 if ( array_key_exists( 'show_cart_edit', $settings ) ) {
642 - add_action( 'sellkit-checkout-widget-disable-quantity', [ Helper::instance(), 'checkout_order_hidden_quantity' ], 10, 2 );
698 + add_filter( 'sellkit-checkout-widget-disable-quantity', [ Helper::instance(), 'checkout_order_hidden_quantity' ], 10, 2 );
643 699
644 700 add_filter( 'sellkit/includes/elementor/modules/checkout/quanity/class', function( $classes ) {
645 701 return $classes .= ' sellkit-checkout-widget-d-block';
646 702 } );
@@ -645,8 +701,14 @@
645 701 return $classes .= ' sellkit-checkout-widget-d-block';
646 702 } );
647 703 }
648 704
705 + if ( array_key_exists( 'show_cart_edit', $settings ) || array_key_exists( 'bundle-products-force', $posted_data ) ) {
706 + add_filter( 'woocommerce_cart_item_class', function( $default ) {
707 + return $default . ' product-title-one-row';
708 + } );
709 + }
710 +
649 711 add_filter( 'sellkit-checkout-place-order-btn-text', function( $place_order_btn ) {
650 712 if ( ! empty( $settings['place_order_btn_txt'] ) ) {
651 713 return $settings['place_order_btn_txt'];
652 714 }
@@ -706,14 +768,14 @@
706 768 }
707 769 ?>
708 770 <?php if ( array_key_exists( 'coupon_field_type', $settings ) && 'collapsible' === $settings['coupon_field_type'] ) : ?>
709 771 <span id="copoun_toggle" class="copoun_toggle sellkit-coupon-toggle sellkit-checkout-widget-links">
710 - <?php echo __( 'Have a coupon? Click here to enter your code', 'sellkit' ); ?>
772 + <?php echo esc_html__( 'Have a coupon? Click here to enter your code', 'sellkit' ); ?>
711 773 </span>
712 774 <?php $class .= ' sellkit-checkout-collapsible'; ?>
713 775 <?php Helper::instance()->editor_mode_extra_js(); ?>
714 776 <?php endif; ?>
715 - <div class="sellkit-custom-coupon-form <?php echo $class; ?>">
777 + <div class="sellkit-custom-coupon-form <?php echo esc_attr( $class ); ?>">
716 778 <p class="jx-form-row-first">
717 779 <input class="jx-coupon" type="text" placeholder="<?php esc_attr_e( 'Enter Promo code', 'sellkit' ); ?>" />
718 780 </p>
719 781
@@ -765,9 +827,9 @@
765 827 * @since 1.1.0
766 828 * return void
767 829 */
768 830 public static function bundle_product_action( $option ) {
769 - add_action( 'sellkit-checkout-widget-disable-quantity', [ Helper::instance(), 'checkout_order_hidden_quantity' ], 10, 2 );
831 + add_filter( 'sellkit-checkout-widget-disable-quantity', [ Helper::instance(), 'checkout_order_hidden_quantity' ], 10, 2 );
770 832
771 833 if ( 'force-products' === $option || Elementor::$instance->editor->is_edit_mode() ) {
772 834 return;
773 835 }
@@ -798,12 +860,25 @@
798 860 </thead>
799 861 <tbody>
800 862 <?php foreach ( $products as $cart_item_key => $cart_item ) : ?>
801 863 <?php
864 + if ( in_array( $cart_item_key, self::$in_cart, true ) ) {
865 + continue;
866 + }
867 +
802 868 $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
803 869 $default = $_product->get_id();
804 870 $default_q = $cart_item['quantity'];
805 871 $unique_id = 'bundle-unique-id-' . $default;
872 + $checked = '';
873 +
874 + if ( 'checkbox' === $fields_type ) {
875 + $checked = 'checked';
876 + }
877 +
878 + if ( 'radio' === $fields_type && array_key_last( $products ) === $cart_item_key ) {
879 + $checked = 'checked';
880 + }
806 881 ?>
807 882 <tr class="sellkit-checkout-bundled-products-item">
808 883 <td class="sellkit-checkout-bundled-title">
809 884 <input
@@ -811,12 +886,12 @@
811 886 value="<?php echo esc_attr( $_product->get_id() ); ?>"
812 887 name="sellkit-checkout-bundle-item"
813 888 class="sellkit-checkout-bundle-item"
814 889 id="<?php echo esc_attr( $unique_id ); ?>"
815 - <?php echo ( array_key_last( $products ) === $cart_item_key ) ? 'checked' : ''; ?>
890 + <?php echo esc_html( $checked ); ?>
816 891 >
817 892 <label for="<?php echo esc_attr( $unique_id ); ?>">
818 - <?php echo $_product->get_name(); ?>
893 + <?php echo esc_html( $_product->get_name() ); ?>
819 894 </label>
820 895 </td>
821 896 <td class="sellkit-checkout-bundled-quantity">
822 897 <input type="number" <?php echo esc_attr( $readonly ); ?> min="1" value="<?php echo esc_attr( $cart_item['quantity'] ); ?>" data-id="<?php echo esc_attr( $cart_item_key ); ?>" class="sellkit-checkout-single-bundle-item-quantity" >
@@ -821,9 +896,9 @@
821 896 <td class="sellkit-checkout-bundled-quantity">
822 897 <input type="number" <?php echo esc_attr( $readonly ); ?> min="1" value="<?php echo esc_attr( $cart_item['quantity'] ); ?>" data-id="<?php echo esc_attr( $cart_item_key ); ?>" class="sellkit-checkout-single-bundle-item-quantity" >
823 898 </td>
824 899 <td class="sellkit-checkout-bundled-price">
825 - <?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?>
900 + <?php echo wp_kses_post( apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ) ); ?>
826 901 </td>
827 902 <tr>
828 903 <?php if ( array_key_last( $products ) !== $cart_item_key ) : ?>
829 904 <tr>
@@ -840,24 +915,71 @@
840 915 <?php
841 916 $bundle_html = ob_get_clean();
842 917
843 918 add_action( 'sellkit-bundled-products-position', function() use ( $bundle_html ) {
844 - echo $bundle_html;
919 + $allowed_html = [
920 + 'section' => [
921 + 'class' => true,
922 + ],
923 + 'div' => [
924 + 'class' => true,
925 + ],
926 + 'span' => [
927 + 'class' => true,
928 + ],
929 + 'table' => [
930 + 'class' => true,
931 + ],
932 + 'thead' => [
933 + 'class' => true,
934 + ],
935 + 'tr' => [
936 + 'class' => true,
937 + ],
938 + 'th' => [
939 + 'class' => true,
940 + ],
941 + 'tbody' => [
942 + 'class' => true,
943 + ],
944 + 'td' => [
945 + 'class' => true,
946 + 'colspan' => true,
947 + ],
948 + 'input' => [
949 + 'type' => true,
950 + 'value' => true,
951 + 'name' => true,
952 + 'class' => true,
953 + 'id' => true,
954 + 'checked' => true,
955 + 'readonly' => true,
956 + 'min' => true,
957 + 'data-id' => true,
958 + ],
959 + 'label' => [
960 + 'for' => true,
961 + ],
962 + 'hr' => [],
963 + ];
964 +
965 + echo wp_kses( $bundle_html, $allowed_html );
845 966 } );
846 967
847 - if ( ! wp_doing_ajax() ) {
968 + if ( wp_doing_ajax() ) {
969 + return;
970 + }
971 +
972 + if ( 'radio' === $fields_type && null !== $default ) {
848 973 WC()->cart->empty_cart();
974 + WC()->cart->add_to_cart( $default, $default_q );
975 + }
849 976
850 - if ( null !== $default ) {
851 - WC()->cart->add_to_cart( $default, $default_q );
977 + if ( ! WC()->cart->needs_shipping() ) {
978 + wp_add_inline_script( 'sellkit-initialize-widgets', 'var sellkitCheckoutShipping = true', 'before' );
979 + }
852 980
853 - if ( ! WC()->cart->needs_shipping() ) {
854 - wp_add_inline_script( 'sellkit-initialize-widgets', 'var sellkitCheckoutShipping = true', 'before' );
855 - }
856 - }
857 -
858 - Global_Hooks::make_changes_after_cart_item_edit( get_the_id() );
859 - }
981 + Global_Hooks::make_changes_after_cart_item_edit( get_the_id() );
860 982 }
861 983
862 984 /**
863 985 * Trigger to activate order bumb or not for this checkout.
@@ -879,8 +1001,12 @@
879 1001 * @since 1.1.0
880 1002 * @return void
881 1003 */
882 1004 private static function order_bump_frontend_manager() {
1005 + if ( self::$is_bumps_applied ) {
1006 + return;
1007 + }
1008 +
883 1009 global $wp_query;
884 1010 $query = $wp_query->query_vars;
885 1011
886 1012 if ( ! array_key_exists( 'bump_data', $query ) ) {
@@ -900,8 +1026,10 @@
900 1026 add_action( $design['sellkit_funnels_bump_position'], function() use ( $design, $products ) {
901 1027 self::bump_html( $design, $products );
902 1028 }, 5 );
903 1029 }
1030 +
1031 + self::$is_bumps_applied = true;
904 1032 }
905 1033
906 1034 /**
907 1035 * Order bump html.
@@ -911,9 +1039,9 @@
911 1039 * @since 1.1.0
912 1040 * @return void
913 1041 */
914 1042 public static function bump_html( $design, $products ) {
915 - $list = $products['list'];
1043 + $list = empty( $products['list'] ) ? [] : $products['list'];
916 1044 $ids = [];
917 1045
918 1046 foreach ( $list as $id => $details ) {
919 1047 $ids[] = $id;
@@ -925,9 +1053,9 @@
925 1053 $ids_string = implode( '|', $ids );
926 1054 $product = wc_get_product( $ids_string );
927 1055 $qty = ( empty( $qty ) ) ? 1 : $qty;
928 1056
929 - if ( empty( $product ) || ! $product->get_id() ) {
1057 + if ( empty( $product ) || ! $product->get_id() || ! $product->is_in_stock() ) {
930 1058 return;
931 1059 }
932 1060
933 1061 $unique_id = 'bump-title-' . $ids_string;
@@ -938,8 +1066,10 @@
938 1066 'sellkit-checkout-after-order-summary' === current_action()
939 1067 ) {
940 1068 $class = 'sellkit-bump-review-order';
941 1069 }
1070 +
1071 + $checked = empty( WC()->cart->find_product_in_cart( WC()->cart->generate_cart_id( $product->get_id() ) ) ) ? false : true;
942 1072 ?>
943 1073 <div class="sellkit-checkout-step-bump-wrapper <?php echo esc_attr( $class ); ?>" >
944 1074 <div class="sellkit-checkout-bump-order-header">
945 1075 <div class="sellkit-bump-order-left-header">
@@ -950,8 +1080,9 @@
950 1080 class="sellkit-checkout-bump-order-products"
951 1081 data-qty="<?php echo esc_attr( $qty ); ?>"
952 1082 name="sellkit_bump_data_<?php echo esc_attr( $ids_string ); ?>"
953 1083 id="<?php echo esc_html( $unique_id ); ?>"
1084 + <?php echo ( true === $checked ) ? 'checked="true"' : ''; ?>
954 1085 >
955 1086 <label
956 1087 for="<?php echo esc_attr( $unique_id ); ?>"
957 1088 class="sellkit-checkout-order-bump-title"
@@ -972,18 +1103,18 @@
972 1103 <del aria-hidden="true">
973 1104 <span class="woocommerce-Price-amount amount">
974 1105 <bdi>
975 1106 <span class="woocommerce-Price-currencySymbol">
976 - <?php echo wc_price( $main_price ); ?>
1107 + <?php echo wp_kses_post( wc_price( $main_price ) ); ?>
977 1108 </span>
978 1109 </bdi>
979 1110 </span>
980 1111 </del>
981 - <bdi class="bump-price-bolded"><?php echo wc_price( $discounted_price ); ?></bdi>
1112 + <bdi class="bump-price-bolded"><?php echo wp_kses_post( wc_price( $discounted_price ) ); ?></bdi>
982 1113 <?php
983 1114 } else {
984 1115 ?>
985 - <bdi><?php echo wc_price( $main_price ); ?></bdi>
1116 + <bdi><?php echo wp_kses_post( wc_price( $main_price ) ); ?></bdi>
986 1117 <?php
987 1118 }
988 1119 ?>
989 1120 </span>
@@ -992,14 +1123,14 @@
992 1123 <div class="sellkit-checkout-bump-order-body" >
993 1124 <div class="sellkit-bump-order-left-body">
994 1125 <?php $image = wp_get_attachment_image_src( $product->get_image_id() ); ?>
995 1126 <?php if ( 'true' === $design['sellkit_funnels_bump_product_image'] && ! empty( $image[0] ) ) : ?>
996 - <img src="<?php echo esc_attr( $image[0] ); ?>" >
1127 + <img src="<?php echo esc_url( $image[0] ); ?>" >
997 1128 <?php endif; ?>
998 1129 </div>
999 1130 <div class="sellkit-bump-order-right-body">
1000 1131 <div class="sellkit-bump-order-description">
1001 - <?php echo $design['sellkit_content']; ?>
1132 + <?php echo wp_kses_post( $design['sellkit_content'] ); ?>
1002 1133 </div>
1003 1134 </div>
1004 1135 </div>
1005 1136 </div>
@@ -1019,13 +1150,30 @@
1019 1150 if ( wp_doing_ajax() ) {
1020 1151 $id = $ajax_id;
1021 1152 }
1022 1153
1023 - $step_data = get_post_meta( $id, 'step_data', true );
1024 - $include_upsell = false;
1025 - $upsell_steps = [];
1026 - $upsell_ids = [];
1154 + $step_data = get_post_meta( $id, 'step_data', true );
1155 + $include_upsell = false;
1156 + $upsell_steps = [];
1157 + $upsell_ids = [];
1158 + $global_checkout_id = get_option( Checkout::SELLKIT_GLOBAL_CHECKOUT_OPTION, 0 );
1027 1159
1160 + // We are in default WooCommerce checkout page.
1161 + if ( empty( $step_data ) && $global_checkout_id > 0 && 'publish' === get_post_status( $global_checkout_id ) ) {
1162 + $steps = get_post_meta( $global_checkout_id, 'nodes', true );
1163 + $checkout_id = 0;
1164 +
1165 + foreach ( $steps as $step ) {
1166 + $step['type'] = (array) $step['type'];
1167 +
1168 + if ( 'checkout' === $step['type']['key'] ) {
1169 + $checkout_id = $step['page_id'];
1170 + }
1171 + }
1172 +
1173 + $step_data = get_post_meta( $checkout_id, 'step_data', true );
1174 + }
1175 +
1028 1176 if ( empty( $step_data ) ) {
1029 1177 return $include_upsell;
1030 1178 }
1031 1179
@@ -1038,8 +1186,22 @@
1038 1186
1039 1187 $popups = [ 'downsell', 'upsell' ];
1040 1188
1041 1189 foreach ( $funnel_data as $step ) {
1190 + if ( isset( $step['data'] ) && isset( $step['data']['products'] ) && isset( $step['data']['products']['list'] ) ) {
1191 + $product_id = array_keys( $step['data']['products']['list'] )[0] ?? 0;
1192 +
1193 + if ( $product_id ) {
1194 + $product = wc_get_product( $product_id );
1195 +
1196 + if ( $product && ! $product->is_in_stock() ) {
1197 + return $include_upsell;
1198 + }
1199 + }
1200 + }
1201 +
1202 + $step['type'] = (array) $step['type'];
1203 +
1042 1204 if ( in_array( $step['type']['key'], $popups, true ) ) {
1043 1205 $include_upsell = true;
1044 1206 $upsell_steps[] = $step;
1045 1207 $upsell_ids[] = $step['page_id'];
@@ -1092,15 +1254,50 @@
1092 1254 }
1093 1255
1094 1256 foreach ( $upsell_data as $data ) {
1095 1257 $id = 'sellkit_funnel_upsell_popup_' . $i;
1096 - $class = 'sellkit_funnel_upsell_popup sellkit_funnel_upsell_popup_' . $data['page_id'];
1258 + $class = 'sellkit_funnel_upsell_popup sellkit_funnel_upsell_popup_' . apply_filters( 'wpml_object_id', $data['page_id'], 'sellkit_step', true ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WPML API.
1097 1259 ?>
1098 1260 <div class="<?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $id ); ?>">
1099 - <?php echo Elementor::instance()->frontend->get_builder_content_for_display( $data['page_id'] ); ?>
1100 - <input type="hidden" class="identify" value="<?php echo esc_attr( $data['page_id'] ); ?>" >
1261 + <?php echo wp_kses_post( Elementor::instance()->frontend->get_builder_content_for_display( apply_filters( 'wpml_object_id', $data['page_id'], 'sellkit_step', true ) ) ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WPML API. ?>
1262 + <input type="hidden" class="identify" value="<?php echo esc_attr( apply_filters( 'wpml_object_id', $data['page_id'], 'sellkit_step', true ) ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WPML API. ?>" >
1101 1263 </div>
1102 1264 <?php
1103 1265 $i++;
1266 + }
1267 + }
1268 +
1269 + /**
1270 + * Display checkout order notes field.
1271 + *
1272 + * @since 1.8.9
1273 + */
1274 + public function order_notes() {
1275 + // Get woocommerce order notes field.
1276 + $notes = WC()->checkout()->get_checkout_fields( 'order' );
1277 +
1278 + // print notes field.
1279 + foreach ( $notes as $key => $field ) {
1280 + ?>
1281 + <div class="sellkit-checkout-order-fields sellkit-widget-checkout-fields">
1282 + <?php
1283 + if ( 'order_comments' === $key ) {
1284 + ?>
1285 + <div class="sellkit-checkout-order-notes">
1286 + <div class="sellkit-order-note-field-wrapper">
1287 + <input id="sellkit-add-notes-to-order-box" type="checkbox">
1288 + <label for="sellkit-add-notes-to-order-box">
1289 + <?php echo esc_html__( 'Add a note to your order', 'sellkit' ); ?>
1290 + </label>
1291 + </div>
1292 + <?php
1293 + woocommerce_form_field( $key, $field, WC()->checkout()->get_value( $key ) );
1294 + ?>
1295 + </div>
1296 + <?php
1297 + }
1298 + ?>
1299 + </div>
1300 + <?php
1104 1301 }
1105 1302 }
1106 1303 }