Home Forums WoodMart support forum Product price showing in search results

Product price showing in search results

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #398697

    nathaliedxb
    Participant

    Hello, 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

    #398778

    Hello,

    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

    #399309

    nathaliedxb
    Participant

    Hi 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!

    #399335

    Hello,

    Unfortunately, we donโ€™t have such code. It requires additional code customization and this is beyond our limitations and support policy.

    Best Regards

Viewing 4 posts - 1 through 4 (of 4 total)