| @@ -19,8 +19,9 @@ | ||
| 19 | 19 | /** |
| 20 | 20 | * SingletonTrait. |
| 21 | 21 | */ |
| 22 | 22 | use SingletonTrait; |
| 23 | + | |
| 23 | 24 | /** |
| 24 | 25 | * Construct function |
| 25 | 26 | */ |
| 26 | 27 | private function __construct() { |
| @@ -26,9 +27,9 @@ | ||
| 26 | 27 | private function __construct() { |
| 27 | 28 | add_action( 'init', [ $this, 'plugins_support' ], 9 ); |
| 28 | 29 | add_action( 'init', [ $this, 'themes_support' ], 9 ); |
| 29 | 30 | add_filter( 'woocommerce_locate_template', [ $this, 'locate_template' ], 10, 3 ); |
| 30 | - if( defined( 'RTSB_DEVELOPER_MODE' ) && RTSB_DEVELOPER_MODE ){ | |
| 31 | + if ( defined( 'RTSB_DEVELOPER_MODE' ) && RTSB_DEVELOPER_MODE ) { | |
| 31 | 32 | $this->developer_support(); |
| 32 | 33 | } |
| 33 | 34 | } |
| 34 | 35 | |
| @@ -47,11 +48,13 @@ | ||
| 47 | 48 | public function plugins_support() { |
| 48 | 49 | // Check for plugin using plugin name. |
| 49 | 50 | $active_plugin = apply_filters( 'active_plugins', get_option( 'active_plugins' ) ); |
| 50 | 51 | $supports = [ |
| 52 | + 'woo-address-book/woocommerce-address-book.php' => PluginsSupport\WooAddressBook::class, | |
| 51 | 53 | 'woo-product-variation-gallery/woo-product-variation-gallery.php' => PluginsSupport\RtwpvgSupport::class, |
| 52 | 54 | 'woo-product-variation-swatches-pro/woo-product-variation-swatches-pro.php' => PluginsSupport\RtwpvsSupport::class, |
| 53 | 55 | ]; |
| 56 | + $supports = apply_filters( 'rtsb/plugins/support', $supports ); | |
| 54 | 57 | foreach ( $supports as $active_path => $class ) { |
| 55 | 58 | $is_active = in_array( $active_path, $active_plugin, true ); |
| 56 | 59 | if ( $is_active && class_exists( $class ) && method_exists( $class, 'instance' ) ) { |
| 57 | 60 | $class::instance(); |
| @@ -91,10 +94,13 @@ | ||
| 91 | 94 | * @return void |
| 92 | 95 | */ |
| 93 | 96 | public function locate_template( $template, $template_name, $template_path ) { |
| 94 | 97 | if ( 'checkout/review-order.php' === $template_name && BuilderFns::is_checkout() ) { |
| 95 | - $id = BuilderFns::is_builder_preview() ? get_the_ID() : BuilderFns::builder_page_id_by_type( 'checkout' ); | |
| 96 | - $elmap = ElementorDataMap::instance(); | |
| 98 | + $id = BuilderFns::is_builder_preview() ? get_the_ID() : BuilderFns::builder_page_id_by_type( 'checkout' ); | |
| 99 | + $elmap = ElementorDataMap::instance(); | |
| 100 | + if ( ! $id ) { | |
| 101 | + return $template; | |
| 102 | + } | |
| 97 | 103 | $get_widget = $elmap->get_widget_data( 'rtsb-shipping-method', [], $id ); |
| 98 | 104 | if ( ! empty( $get_widget ) ) { |
| 99 | 105 | $template = Fns::locate_template( 'elementor/checkout/customized-order-review' ); |
| 100 | 106 | } |
| @@ -103,7 +109,5 @@ | ||
| 103 | 109 | } |
| 104 | 110 | |
| 105 | 111 | return $template; |
| 106 | 112 | } |
| 107 | - | |
| 108 | - | |
| 109 | 113 | } |