Skip to content
Public Ticket #32042

search results

Conversation thread

PenciDesign Supporter replied

Staff Reply

Hi,

I’ve modified the search function on your site. The search results will now show product items only on the WooCommerce template.

Please clear all the browser caches and check again.

Regards,
PenciDesign.

yara replied

Customer Reply

yes you already told me this, and i asked how to fix it, how do i make the search by woo-commerce so that people can search products and find them instead of blogs. 

PenciDesign Supporter replied

Staff Reply

Hi,

The search results are now showing posts only. Product post types are excluded and will appear only when you search using the WooCommerce search.

Here is an example: https://toycenterleb.com/?s=home

Regards,
PenciDesign.

yara replied

Customer Reply

now when i search for something it says " item not found"

PenciDesign Supporter replied

Staff Reply

Hi,

I’ve updated the code. Please check it.

Regards,
PenciDesign.

yara replied

Customer Reply

hello again, i searched using the search box but its still not working the right way

PenciDesign Supporter replied

Staff Reply

Hi,

I’ve added this code to your site. Please check it.

Regards,
PenciDesign.

PenciDesign Supporter replied

Staff Reply

Hi,

You should paste this code into the function.php of the child theme or via the CodeSnippet plugin here: https://wordpress.org/plugins/code-snippets/

function penci_search_only_posts( $query ) {
    // Run only on frontend main search query
    if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) {
        $query->set( 'post_type', 'post' );
    }
    return $query;
}
add_action( 'pre_get_posts', 'penci_search_only_posts' );

Regards,
PenciDesign.

yara replied

Customer Reply

SO HOW DO I FIX IT? CAN YOU FIX IT FOR ME IF I PROVIDE YOU WITH LOGINS PLEASE

PenciDesign Supporter replied

Staff Reply

Hi,

The issue is that this search bar is designed for normal posts, not for products, so it cannot display product prices. Product prices and other product details will only appear when searching through the WooCommerce/Product Search form.

Regards,
PenciDesign. 

yara started the conversation

Conversation Start

 when i search something in search bar, the products appear but without their prices. i need the prices to show. and why are the images like this half the image is not visible?

Want to join this conversation or access attachments? Sign in first.