Home › Forums › WoodMart support forum › Product price showing in search results
Product price showing in search results
- This topic has 3 replies, 2 voices, and was last updated 2 years, 3 months ago by Aizaz Imtiaz Awan.
-
AuthorPosts
-
August 22, 2022 at 10:14 am #398697
nathaliedxbParticipantHello, we have lots of products on our store whereby we mark them as out of stock, and using a code snippet we hide the price. These products are therefore ‘enquire’ only – this is due to the market price of our products fluctuating daily that we cannot advertise the sale price live on the website.
We are facing a major issue however, when customers are searching the products – in the search results the products price is still showing, we really need this not to show when out of stock because its detrimental to our business – customers are now asking we honor these prices which we cannot do.
Please see video explanation:
https://www.loom.com/share/0f6422beebdc4b5593e10fce89d5c381
Please could you advise what snippet of code we could use to make sure these prices are not showing in the filter results for out of stock products?
thanks so much1
August 22, 2022 at 3:47 pm #398778
Aizaz Imtiaz AwanKeymasterHello,
Could you please check how it works with the default wordpress theme just to check whether the issue is with our theme or not.
Best Regards
August 24, 2022 at 3:13 pm #399309
nathaliedxbParticipantHi Aizaz,
I created a staging site and changed the theme to Twenty-Twenty Two (WordPress default) as per your request, but I cannot even see a search feature on this theme to test what you are asking 🙁
Please see staging here using the default theme: https://woocommerce-627090-2841648.cloudwaysapps.com/
Basically, when we used to use the Rey theme (before changing to Woodmart) we encountered a similar issue whereby the product price for out-of-stock items was still showing in the search results. The theme developer provided us with this code:
add_filter( ‘woocommerce_get_price_html’, ‘bbloomer_hide_price_if_out_stock_frontend’, 9999, 2 );
function bbloomer_hide_price_if_out_stock_frontend( $price, $product ) {
if ( is_admin() && ! isset($_REQUEST[‘s’]) ) return $price; // BAIL IF BACKEND
if ( ! $product->is_in_stock() ) {
$price = apply_filters( ‘woocommerce_empty_price_html’, ”, $product );
}return $price;
}This code worked perfectly to stop the price showing for out-of-stock items in the search results, I tried to apply the same code but it didn’t work on woodmart, could you please help with this?
Thanks so much in advance!
August 24, 2022 at 3:57 pm #399335
Aizaz Imtiaz AwanKeymasterHello,
Unfortunately, we don’t have such code. It requires additional code customization and this is beyond our limitations and support policy.
Best Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register