Override the WooCommerce Query and get only products on sale for the FacetWP Query
Use this by linking to theproduct archive URL with the parameter ?salearchive
<?php
add_action( 'woocommerce_product_query', 'yanco_product_sales_query' );
function yanco_product_sales_query( $query ){
if( isset( $_GET['salearchive'] ) ) {
$product_ids_on_sale = wc_get_product_ids_on_sale();
$meta_query = WC()->query->get_meta_query();
$query->set( 'post__in', array_merge( array( 0 ), $product_ids_on_sale ) );
}
}