Divi compatibility

<?php
/** Divi compatibility for shop module
 ** DO NOT use for default theme archive pages
 **/
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) {
    if ( $query->is_main_query() && 'product_query' == $query->get( 'wc_query' ) && 'product' == $query->get( 'post_type' ) ) {
        $is_main_query = false;
    }
    return $is_main_query;
}, 10, 2 );

/** bust shortcode cache for woocommerce to make sure facet finds a query **/
add_filter( 'shortcode_atts_products', function( $atts ) {
	$atts['cache'] = false;
	return $atts;
} );

/** Divi compatibility for default theme shop archive **/
add_action( 'woocommerce_before_shop_loop', function() {
    if ( !is_singular() ) { ?>
        <div class="facetwp-template">
    <?php }
}, 5);
add_action( 'woocommerce_after_shop_loop', function() {
    if ( !is_singular() ) { ?>
        </div><!-- end facetwp-template -->
    <?php }
}, 15);
add_action( 'woocommerce_no_products_found', function() {
    if ( !is_singular() ) { ?>
        <div class="facetwp-template">
    <?php }
}, 5);
add_action( 'woocommerce_no_products_found', function() {
    if ( !is_singular() ) { ?>
        </div><!-- end facetwp-template -->
    <?php }
}, 15);