PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.5
ShopBuilder – WooCommerce Builder For Elementor v3.2.5
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/Controllers/BuilderController.php +39 -88 3.4.13.2.5 View file →
@@ -187,24 +187,45 @@
187 187 continue;
188 188 }
189 189
190 190 if ( ! empty( $element['category'] ) ) {
191 - try {
192 - $widget = false;
193 - $import = apply_filters( 'rtsb_import_status', false );
194 -
195 - if ( $this->should_register_widget( $element['category'], $import ) ) {
191 + $widget = false;
192 + $import = apply_filters( 'rtsb_import_status', false );
193 + switch ( $element['category'] ) {
194 + case 'product':
195 + if ( BuilderFns::is_product() || $import ) {
196 + $widget = new $element['base_class']();
197 + }
198 + break;
199 + case 'shop':
200 + if ( BuilderFns::is_archive() || BuilderFns::is_shop() || $import ) {
201 + $widget = new $element['base_class']();
202 + }
203 + break;
204 + case 'archive':
205 + if ( BuilderFns::is_archive() || $import ) {
206 + $widget = new $element['base_class']();
207 + }
208 + break;
209 + case 'cart':
210 + if ( BuilderFns::is_cart() || $import ) {
211 + $widget = new $element['base_class']();
212 + }
213 + break;
214 + case 'checkout':
215 + if ( BuilderFns::is_checkout() || $import ) {
216 + $widget = new $element['base_class']();
217 + }
218 + break;
219 + case 'general':
196 220 $widget = new $element['base_class']();
197 - }
221 + break;
222 + default:
223 + }
224 + $widget = apply_filters( 'rtsb/element/list/init/widgets', $widget, $element );
198 225
199 - $widget = apply_filters( 'rtsb/element/list/init/widgets', $widget, $element );
200 -
201 - if ( $widget && is_object( $widget ) ) {
202 - $widgets_manager->register( $widget );
203 - }
204 - } catch ( \Throwable $e ) {
205 - error_log( 'ShopBuilder widget error (' . $element['base_class'] . '): ' . $e->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
206 - continue;
226 + if ( $widget && is_object( $widget ) ) {
227 + $widgets_manager->register( $widget );
207 228 }
208 229 }
209 230 }
210 231 }
@@ -209,48 +230,8 @@
209 230 }
210 231 }
211 232
212 233 /**
213 - * Determine whether a widget for the given category should be registered
214 - * in the current request context.
215 - *
216 - * @param string $category Element category.
217 - * @param bool $import Whether an import is in progress.
218 - *
219 - * @return bool
220 - */
221 - protected function should_register_widget( $category, $import ) {
222 - // On the frontend the Elementor Widgets Manager can initialise at an
223 - // unpredictable time — e.g. Elementor Pro's Theme Builder boots it on
224 - // template_redirect — when WooCommerce query conditionals such as
225 - // is_shop()/is_archive() are not yet reliable. Widget registration is
226 - // cached for the whole request, so gating it by those conditionals can
227 - // permanently skip ShopBuilder widgets, leaving the builder template to
228 - // render empty container shells. Register unconditionally on the
229 - // frontend; keep the per-category gate only for the editor widget panel.
230 - if ( ! is_admin() ) {
231 - return true;
232 - }
233 -
234 - switch ( $category ) {
235 - case 'product':
236 - return BuilderFns::is_product() || $import;
237 - case 'shop':
238 - return BuilderFns::is_archive() || BuilderFns::is_shop() || $import;
239 - case 'archive':
240 - return BuilderFns::is_archive() || $import;
241 - case 'cart':
242 - return BuilderFns::is_cart() || $import;
243 - case 'checkout':
244 - return BuilderFns::is_checkout() || $import;
245 - case 'general':
246 - return true;
247 - default:
248 - return false;
249 - }
250 - }
251 -
252 - /**
253 234 * Adding custom icons in Elementor
254 235 *
255 236 * @param array $tabs Tabs.
256 237 *
@@ -321,20 +302,12 @@
321 302
322 303 $parent_class = apply_filters( 'rtsb/builder/content/parent_class', [] );
323 304
324 305 if ( BuilderFns::is_product() ) {
325 - $product_id = Fns::get_prepared_product_id();
326 -
327 - // Ensure the WordPress global $product is a valid WC_Product before
328 - // wc_get_product_class() fires the `woocommerce_post_class` filter.
329 - // Some themes (e.g. Blocksy) read the global $product directly inside
330 - // that filter and call methods like get_type() on it, which throws a
331 - // fatal error when the global is still an unresolved string.
332 - $_product = Fns::get_product();
333 -
306 + $product_id = Fns::get_prepared_product_id();
334 307 $parent_class = wc_get_product_class( $parent_class, $product_id );
335 -
336 - if ( function_exists( 'rtwpvs' ) && $_product instanceof \WC_Product ) {
308 + if ( function_exists( 'rtwpvs' ) ) {
309 + $_product = Fns::get_product();
337 310 if ( $_product->is_type( 'variable' ) ) {
338 311 $parent_class[] = 'rtwpvs-product';
339 312 $beside_label = function_exists( 'rtwpvsp' ) && rtwpvs()->get_option( 'attribute_on_click_behavior' );
340 313 if ( $beside_label ) {
@@ -363,29 +336,8 @@
363 336 if ( BuilderFns::is_checkout() ) {
364 337 if ( ! apply_filters( 'rtsb/multi/step/checkout/widget', true ) ) {
365 338 return;
366 339 }
367 -
368 - $checkout = WC()->checkout();
369 -
370 - // Temporarily remove callbacks that Elementor checkout
371 - // handles via separate widgets to prevent duplicates.
372 - remove_action( 'woocommerce_before_checkout_form', [ Hooks\ActionHooks::class, 'woocommerce_checkout_login_form' ], 10 );
373 - remove_action( 'woocommerce_before_checkout_form', [ Hooks\ActionHooks::class, 'woocommerce_checkout_coupon_form' ], 10 );
374 - remove_action( 'woocommerce_before_checkout_form', [ Fns::class, 'woocommerce_output_all_notices' ], 10 );
375 -
376 - do_action( 'woocommerce_before_checkout_form', $checkout );
377 -
378 - // Restore callbacks for non-Elementor contexts.
379 - add_action( 'woocommerce_before_checkout_form', [ Hooks\ActionHooks::class, 'woocommerce_checkout_login_form' ], 10 );
380 - add_action( 'woocommerce_before_checkout_form', [ Hooks\ActionHooks::class, 'woocommerce_checkout_coupon_form' ], 10 );
381 - add_action( 'woocommerce_before_checkout_form', [ Fns::class, 'woocommerce_output_all_notices' ], 10 );
382 -
383 - // If checkout registration is disabled and not logged in, the user cannot checkout.
384 - if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in() ) {
385 - echo esc_html( apply_filters( 'woocommerce_checkout_must_be_logged_in_message', __( 'You must be logged in to checkout.', 'shopbuilder' ) ) );
386 - return;
387 - }
388 340 ?>
389 341 <!--
390 342 woocommerce-checkout added for fix issue with payment method ( Revolut Pay )
391 343 -->
@@ -417,9 +369,8 @@
417 369 }
418 370 ?>
419 371 </form>
420 372 <?php
421 - do_action( 'woocommerce_after_checkout_form', WC()->checkout() );
422 373 }
423 374 ?>
424 375 </div>
425 376 <!-- After Content end -->
@@ -457,9 +408,9 @@
457 408 $args = [
458 409 'hide_empty' => false,
459 410 'orderby' => 'name',
460 411 'order' => 'ASC',
461 - 'name__like' => $search,
412 + 'search' => $search,
462 413 'number' => '5',
463 414 ];
464 415
465 416 if ( 'all' !== $post_type ) {