PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.6
ShopBuilder – WooCommerce Builder For Elementor v3.2.6
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | app/Modules/ShopifyCheckout/ShopifyCheckout.php +3 -83 3.4.23.2.6 View file →
@@ -39,10 +39,8 @@
39 39 $this->options = Fns::get_options( 'modules', 'shopify_checkout' ); // Assign options to the global variable.
40 40 $shopify_checkout_options = $this->options;
41 41 add_filter( 'template_include', [ $this, 'custom_checkout_template' ], 99 );
42 42 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_public_scripts' ], 99 );
43 - add_action( 'wp_enqueue_scripts', [ $this, 'disable_elementor_assets' ], 100 );
44 - add_action( 'wp_print_scripts', [ $this, 'disable_elementor_assets' ], 100 );
45 43 do_action( 'rtsb/loaded/shopify/checkout' );
46 44 }
47 45 /**
48 46 * @param string $template path.
@@ -51,14 +49,15 @@
51 49 public function custom_checkout_template( $template ) {
52 50 if ( defined( 'RTSBPRO_VERSION' ) && version_compare( RTSBPRO_VERSION, '1.8.0', '<' ) ) {
53 51 return $template;
54 52 }
55 - if ( ! $this->is_shopify_checkout_page() ) {
53 + $is_checkout_page = is_checkout() && ! is_order_received_page() && ! is_checkout_pay_page();
54 + if ( ! $is_checkout_page ) {
56 55 return $template;
57 56 }
58 57 $shopify_template = 'shopify-checkout/checkout';
59 58 $custom_template = Fns::locate_template( $shopify_template );
60 - if ( file_exists( $custom_template ) ) {
59 + if ( is_checkout() && file_exists( $custom_template ) ) {
61 60 return $custom_template;
62 61 }
63 62 return $template;
64 63 }
@@ -63,59 +62,10 @@
63 62 return $template;
64 63 }
65 64
66 65 /**
67 - * Determine if the current request will render the Shopify-style checkout template.
68 - *
69 - * @return bool True when on the WooCommerce checkout page (not order-received, not pay page).
70 - */
71 - public function is_shopify_checkout_page() {
72 - if ( ! function_exists( 'is_checkout' ) ) {
73 - return false;
74 - }
75 - return is_checkout() && ! is_order_received_page() && ! is_checkout_pay_page();
76 - }
77 -
78 - /**
79 - * Dequeue/deregister Elementor frontend scripts on the Shopify checkout page.
80 - *
81 - * The Shopify-style checkout overrides the page template, so Elementor does
82 - * not localize `elementorFrontendConfig`. Any Elementor frontend script that
83 - * still loads (via theme header/footer or other plugins) throws
84 - * "elementorFrontendConfig is not defined". Strip those handles here so the
85 - * Shopify checkout stays fully independent of Elementor JS.
86 - *
87 - * Filterable via `rtsb/shopify_checkout/disable_elementor` (bool) and
88 - * `rtsb/shopify_checkout/dequeue_handles` (array of script handles).
89 - *
90 66 * @return void
91 67 */
92 - public function disable_elementor_assets() {
93 - if ( ! $this->is_shopify_checkout_page() ) {
94 - return;
95 - }
96 - if ( ! apply_filters( 'rtsb/shopify_checkout/disable_elementor', true ) ) {
97 - return;
98 - }
99 - $handles = apply_filters(
100 - 'rtsb/shopify_checkout/dequeue_handles',
101 - [
102 - 'elementor-frontend',
103 - 'elementor-frontend-modules',
104 - 'elementor-pro-frontend',
105 - 'elementor-sticky',
106 - 'elementor-waypoints',
107 - ]
108 - );
109 - foreach ( $handles as $handle ) {
110 - wp_dequeue_script( $handle );
111 - wp_deregister_script( $handle );
112 - }
113 - }
114 -
115 - /**
116 - * @return void
117 - */
118 68 public function enqueue_public_scripts() {
119 69 // Enqueue assets.
120 70 Fns::enqueue_module_assets(
121 71 Fns::optimized_handle( 'rtsb-shopify-checkout' ),
@@ -124,29 +74,8 @@
124 74 'type' => 'css',
125 75 ]
126 76 );
127 77
128 - // The Shopify-style checkout template always renders `.rtsb-sticky-element`,
129 - // which the frontend bundle initialises via `theiaStickySidebar()`. Ensure
130 - // the vendor handle is enqueued whenever it is registered (Pro is active),
131 - // regardless of multi-step mode, so `$().theiaStickySidebar is not a function`
132 - // can never occur on the Shopify checkout page.
133 - if ( $this->is_shopify_checkout_page() && wp_script_is( 'rtsb-sticky-sidebar', 'registered' ) ) {
134 - wp_enqueue_script( 'rtsb-sticky-sidebar' );
135 - }
136 -
137 - // Flag for frontend JS modules to skip Elementor-dependent code paths.
138 - $is_shopify_checkout = $this->is_shopify_checkout_page();
139 - $disable_elementor = $is_shopify_checkout && apply_filters( 'rtsb/shopify_checkout/disable_elementor', true );
140 - wp_localize_script(
141 - Fns::optimized_handle( 'rtsb-public' ),
142 - 'rtsbShopifyCheckoutMeta',
143 - [
144 - 'isShopifyCheckout' => $is_shopify_checkout,
145 - 'disableElementor' => $disable_elementor,
146 - ]
147 - );
148 -
149 78 $cache_key = 'shopify_style_cache';
150 79
151 80 // Selector variables.
152 81 $step_menu_selector = '.shopify-multistep-menu ul li a';
@@ -167,17 +96,8 @@
167 96 'header_cart_icon_color' => [ 'selector' => $cart_icon, 'property' => 'color' ],
168 97 'header_cart_icon_hover_color' => [ 'selector' => "$cart_icon:hover", 'property' => 'color' ],
169 98 'header_cart_icon_font_size' => [ 'selector' => $cart_icon, 'property' => 'font-size', 'unit' => 'px' ],
170 99 'shopify_cart_icon_height' => [ 'selector' => "$cart_icon :is(svg, img)", 'property' => 'height', 'unit' => 'px' ],
171 - 'cart_button_height' => [ 'selector' => $cart_icon, 'property' => 'height', 'unit' => 'px' ],
172 - 'cart_button_width' => [ 'selector' => $cart_icon, 'property' => 'width', 'unit' => 'px' ],
173 - 'cart_button_padding' => [ 'selector' => $cart_icon, 'property' => 'padding', 'unit' => 'px' ],
174 - 'cart_button_border_style' => [ 'selector' => $cart_icon, 'property' => 'border-style' ],
175 - 'cart_button_border_width' => [ 'selector' => $cart_icon, 'property' => 'border-width', 'unit' => 'px' ],
176 - 'cart_button_border_color' => [ 'selector' => $cart_icon, 'property' => 'border-color' ],
177 - 'cart_button_border_radius' => [ 'selector' => $cart_icon, 'property' => 'border-radius', 'unit' => 'px' ],
178 - 'cart_button_bg_color' => [ 'selector' => $cart_icon, 'property' => 'background-color' ],
179 - 'cart_button_hover_bg_color' => [ 'selector' => "$cart_icon:hover", 'property' => 'background-color' ],
180 100 'step_menu_color' => [ 'selector' => $step_menu_selector, 'property' => 'color' ],
181 101 'step_menu_hover_color' => [ 'selector' => "$step_menu_selector:hover, $step_menu_active_selector", 'property' => 'color' ],
182 102 'step_menu_font_size' => [ 'selector' => $step_menu_selector, 'property' => 'font-size', 'unit' => 'px' ],
183 103 'next_button_height' => [ 'selector' => $next_button_selector, 'property' => 'height', 'unit' => 'px' ],