I need to create a product archive page (usually a Store in WooCommerce ), but displays ONLY SALE products ONLY . Basically, it should use the same layout template as in archive-product.php . There will be a link in the main menu that will be directed to this page. How can I do it?
UPDATE
I managed to filter ON SALE products using the code below, located just above the line if ( have_posts() ) : ...
$args = array( 'post_type' => 'product', 'order' => 'ASC', 'paged' => $paged, 'meta_query' => array( array( 'key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric' ) ) ); query_posts( $args );
The code is placed in copy from archive-product.php , which I named archive-product_sale.php and is made as a page template .
However, this only works for simple products , and I need it to work for both Simple products and Variable .. p>
wordpress product archive woocommerce products
Giraldi
source share