manifest.php
87 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ShopEngine\Compatibility\Conflicts; |
| 4 | |
| 5 | use ShopEngine\Widgets\Widget_Helper; |
| 6 | |
| 7 | class Manifest { |
| 8 | |
| 9 | public function init() { |
| 10 | |
| 11 | add_action('elementor/element/before_section_start', [$this, 'elementor_editor_conflict'], 10, 2); |
| 12 | add_action('elementor/element/before_section_start', function ($element) { |
| 13 | |
| 14 | /** |
| 15 | * In woodmart theme image with gallery does not work properly. so temporary fix |
| 16 | * Hooks tried are - |
| 17 | * elementor/editor/before_enqueue_scripts |
| 18 | * elementor/element/before_section_start |
| 19 | * elementor/element/after_section_end |
| 20 | */ |
| 21 | wp_enqueue_script('flexslider'); |
| 22 | |
| 23 | /** |
| 24 | * remove unwanted breadcrumb in shop and archive page |
| 25 | */ |
| 26 | remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0); |
| 27 | |
| 28 | global $is_used_shopengine_template; |
| 29 | if($is_used_shopengine_template) { |
| 30 | remove_action('woocommerce_before_single_product', 'woocommerce_output_all_notices', 10); |
| 31 | } |
| 32 | }, 9000, 1); |
| 33 | |
| 34 | |
| 35 | // Check if the Yith Delivery Date Plugin Is There |
| 36 | if(class_exists('\YITH_Delivery_Date_Shipping_Manager')){ |
| 37 | |
| 38 | // They added this action specifically after 2.7.0 version so we need to check if we are using 2.7.0 or higher |
| 39 | if ( version_compare( WC()->version, '2.7.0', '>=' ) ) { |
| 40 | |
| 41 | $yith_date_manager = \YITH_Delivery_Date_Shipping_Manager::get_instance(); |
| 42 | |
| 43 | // Remove the actual action that used by Yith. |
| 44 | remove_action( 'woocommerce_checkout_shipping', array( $yith_date_manager, 'print_delivery_from' ), 20 ); |
| 45 | |
| 46 | // Invoked their own method to print delivery from |
| 47 | add_action( 'woocommerce_after_order_notes', array( $yith_date_manager, 'print_delivery_from' ), 20 ); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | } |
| 52 | |
| 53 | public function elementor_editor_conflict($element, $section_id) { |
| 54 | |
| 55 | $in_editor_mode = \Elementor\Plugin::$instance->editor->is_edit_mode(); |
| 56 | |
| 57 | if('shopengine-cross-sells' === $element->get_name() && $in_editor_mode) { |
| 58 | |
| 59 | Theme_Hooks::instance()->theme_conflicts_in_elementor_editor_cross_sells(); |
| 60 | |
| 61 | } elseif('shopengine-related' === $element->get_name() && $in_editor_mode) { |
| 62 | |
| 63 | Theme_Hooks::instance()->theme_conflicts_in_elementor_editor_related_products(); |
| 64 | |
| 65 | } elseif('shopengine-account-dashboard' === $element->get_name() && $in_editor_mode) { |
| 66 | |
| 67 | Theme_Hooks::instance()->theme_conflicts_my_account_page(); |
| 68 | |
| 69 | } elseif('shopengine-cart-table' === $element->get_name() && $in_editor_mode) { |
| 70 | |
| 71 | Theme_Hooks::instance()->theme_conflicts_empty_cart_page(); |
| 72 | |
| 73 | } elseif('shopengine-archive-products' === $element->get_name() && $in_editor_mode) { |
| 74 | |
| 75 | Theme_Hooks::instance()->theme_conflicts_in_editor__archive_products_widget(); |
| 76 | |
| 77 | } elseif('shopengine-product-tabs' === $element->get_name() && $in_editor_mode) { |
| 78 | |
| 79 | Theme_Hooks::instance()->theme_conflicts_in_editor__product_tabs_widget(); |
| 80 | |
| 81 | } elseif('shopengine-up-sells' === $element->get_name() && $in_editor_mode) { |
| 82 | |
| 83 | Theme_Hooks::instance()->theme_conflicts_in_elementor_editor_up_sells(); |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 |