diff --git a/inc/compatibility/woocommerce.php b/inc/compatibility/woocommerce.php index bb474214c2..b3d8ca30d9 100644 --- a/inc/compatibility/woocommerce.php +++ b/inc/compatibility/woocommerce.php @@ -284,8 +284,13 @@ public function register_hooks() { add_action( 'admin_footer', array( $this, 'update_woo_width' ) ); // Wrap content. - add_action( 'neve_after_primary_start', array( $this, 'wrap_pages_start' ) ); - add_action( 'neve_before_primary_end', array( $this, 'wrap_pages_end' ) ); + if ( function_exists( 'elementor_location_exits' ) && ( elementor_location_exits( 'header' ) ) ) { + add_action( 'woocommerce_before_main_content', array( $this, 'wrap_pages_start' ) ); + add_action( 'woocommerce_after_main_content', array( $this, 'wrap_pages_end' ) ); + } else { + add_action( 'neve_after_primary_start', array( $this, 'wrap_pages_start' ) ); + add_action( 'neve_before_primary_end', array( $this, 'wrap_pages_end' ) ); + } add_action( 'woocommerce_before_main_content', array( $this, 'wrap_main_content_start' ), 15 ); add_action( 'woocommerce_after_main_content', array( $this, 'close_div' ), 15 ); @@ -538,6 +543,10 @@ public function wrap_pages_start() { if ( ! is_woocommerce() ) { return; } + + if ( doing_action( 'woocommerce_before_main_content' ) ) { + echo '
'; + } echo '
'; echo '
'; } @@ -551,6 +560,9 @@ public function wrap_pages_end() { } $this->close_div(); $this->close_div(); + if ( doing_action( 'neve_before_primary_end' ) ) { + $this->close_div(); + } } /**