exists() ) { return; } if(flatsome_option('max_related_products')) $posts_per_page = flatsome_option('max_related_products'); $related = $product->get_related( $posts_per_page ); if ( sizeof( $related ) === 0 ) return; $args = apply_filters( 'woocommerce_related_products_args', array( 'post_type' => 'product', 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'posts_per_page' => $posts_per_page, 'post__in' => $related, 'post__not_in' => array( $product->get_id() ) ) ); $products = new WP_Query( $args ); if($type == 'grid') $type = 'row'; // Disable slider if less than selected products pr row. if ( sizeof( $related ) < (flatsome_option('related_products_pr_row')+1) ) { $type = 'row'; } $repater['type'] = $type; $repater['columns'] = flatsome_option('related_products_pr_row'); $repater['slider_style'] = 'reveal'; $repater['row_spacing'] = 'small'; if ( $products->have_posts() ) : ?>