| @@ -25,19 +25,10 @@ | ||
| 25 | 25 | */ |
| 26 | 26 | private function __construct() { |
| 27 | 27 | add_action( 'init', [ $this, 'plugins_support' ], 9 ); |
| 28 | 28 | add_action( 'init', [ $this, 'themes_support' ], 9 ); |
| 29 | - add_filter( 'woocommerce_locate_template', [ $this, 'locate_template' ], 10, 3 ); | |
| 30 | - if( defined( 'RTSB_DEVELOPER_MODE' ) && RTSB_DEVELOPER_MODE ){ | |
| 31 | - $this->developer_support(); | |
| 32 | - } | |
| 33 | - } | |
| 29 | + add_filter( 'woocommerce_locate_template', [ $this, 'shipping_method_support' ], 10, 3 ); | |
| 34 | 30 | |
| 35 | - /** | |
| 36 | - * @return void | |
| 37 | - */ | |
| 38 | - public function developer_support() { | |
| 39 | - add_filter( 'rtsb/builder/args/publicly_queryable', '__return_true', 5 ); | |
| 40 | 31 | } |
| 41 | 32 | |
| 42 | 33 | /** |
| 43 | 34 | * Theme Support |
| @@ -89,18 +80,18 @@ | ||
| 89 | 80 | * Theme Support |
| 90 | 81 | * |
| 91 | 82 | * @return void |
| 92 | 83 | */ |
| 93 | - public function locate_template( $template, $template_name, $template_path ) { | |
| 94 | - 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(); | |
| 97 | - $get_widget = $elmap->get_widget_data( 'rtsb-shipping-method', [], $id ); | |
| 98 | - if ( ! empty( $get_widget ) ) { | |
| 99 | - $template = Fns::locate_template( 'elementor/checkout/customized-order-review' ); | |
| 100 | - } | |
| 101 | - } elseif ( 'single-product/tabs/description.php' === $template_name && BuilderFns::is_product() ) { | |
| 102 | - $template = Fns::locate_template( 'elementor/single-product/tab-description' ); | |
| 84 | + public function shipping_method_support( $template, $template_name, $template_path ) { | |
| 85 | + if ( 'checkout/review-order.php' !== $template_name || ! BuilderFns::is_checkout() ) { | |
| 86 | + return $template; | |
| 87 | + } | |
| 88 | + | |
| 89 | + $id = BuilderFns::is_builder_preview() ? get_the_ID() : BuilderFns::builder_page_id_by_type( 'checkout' ); | |
| 90 | + $elmap = ElementorDataMap::instance(); | |
| 91 | + $get_widget = $elmap->get_widget_data( 'rtsb-shipping-method', [], $id ); | |
| 92 | + if ( ! empty( $get_widget ) ) { | |
| 93 | + $template = Fns::locate_template( 'elementor/checkout/customized-order-review' ); | |
| 103 | 94 | } |
| 104 | 95 | |
| 105 | 96 | return $template; |
| 106 | 97 | } |