Create a Search Form that only Searches with WooCommerce Sale Products

Question

I am trying to create a search form that will search within products that are on sale/promotion within WooCommerce. Here is what I have so far:

<form method="get" action="<?php echo esc_url( home_url( "https://wordpress.stackexchange.com/" ) ); ?>">
    <input type="hidden" post_type="product" post__in="wc_get_product_ids_on_sale" />
    <input type="text" size="16" name="s" value="Search"  />
    <input type="submit" value="Go" />
</form>

0
moorewebx 3 weeks 2021-09-28T11:45:13-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse