is_main_query() ) { return; } if ( ! class_exists( 'WooCommerce' ) ) { return; } if ( ! function_exists( 'wc_get_page_id' ) ) { return; } // Check if current page is product archive page. Most page will fail on this. // initially used is_shop(), but is_shop()'s is_page() check throws error at // this early hook on homepage if shop page !== page_on_front if ( ! is_post_type_archive( 'product' ) ) { return; } // Note that the following check is only performed on product archive page. $shop_page_id = wc_get_page_id( 'shop' ); $shop_page_object = get_post( $shop_page_id ); $is_shop_page_exist = isset( $shop_page_object->post_type ) && 'page' === $shop_page_object->post_type; if ( ! $is_shop_page_exist ) { return; } if ( ! et_pb_is_pagebuilder_used( $shop_page_id ) ) { return; } // Set et_builder_used_in_wc_shop() global to true $et_builder_used_in_wc_shop = true; // Overwrite page query. This overwrite enables is_page() and other standard // page-related function to work normally after pre_get_posts hook $query->set( 'page_id', $shop_page_id ); $query->set( 'post_type', 'page' ); $query->set( 'posts_per_page', 1 ); $query->set( 'wc_query', null ); $query->set( 'meta_query', array() ); $query->is_singular = true; $query->is_post_type_archive = false; $query->is_archive = false; // Avoid unwanted

at the beginning of the rendered builder remove_filter( 'the_content', 'wpautop' ); } add_action( 'pre_get_posts', 'et_builder_wc_pre_get_posts' ); /** * Remove woocommerce body classes if current shop page uses builder. * woocommerce-page body class causes builder's shop column styling to be irrelevant. * @param array body classes * @return array modified body classes */ function et_builder_wc_body_class( $classes ) { if ( et_builder_used_in_wc_shop() ) { $classes = array_diff( $classes, array( 'woocommerce', 'woocommerce-page' ) ); } return $classes; } add_filter( 'body_class', 'et_builder_wc_body_class' );