Try below filter in your function.php file
function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'product');
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');
Hope this will help!
Related Posts:
- Search results don’t show products
- How to search Woo Commerce products with punctuation in title?
- Woocommerce wp-admin search products through custom meta value too
- Send a value to woocommerce with a button type submit
- if statement for search results
- Creating a multisite registration form that also creates a woocommerce post
- Signup Form that adds customer to MailChimp, redirects to checkout, and fills in form data
- How to clear woocommerce checkout form after pageload
- How can I use a gravity form to send an e-card?
- Separeting product from post in search result
- Woocommerce custom search
- Send billing info from woocommerce checkout page to paypal checkout form
- Change the Title Tag of Search Products Page
- WooCommerce orderby template disappears and not longer works on search page
- search customers in front end by billing data
- Is it possible to update the total price on the checkout page in woocommerce from a custom field
- Create a shortcode for native WooCommerce search form [closed]
- Can’t find a product by SKU
- Absolute search against wordpress api
- override the default WooCommerce products search form
- WordPress Multi-Step Product Search
- Make e-Mail optional on Woocommerce sign up
- Create a Search Form that only Searches with WooCommerce Sale Products
- Call product search from custom hook
- Search doesn’t return anything
- edit URL of search result
- No Results in WooCommerce Product Search
- Woocommerce Multisite global search how to mod ajax function?
- I wan redirect link post search to search product woocommerce?
- How to filter result set in custom metaboxes?
- Woocommerce: Search by custom attribute
- Editing fields required in the WooCommerce / WordPress registration form [closed]
- Notice: Trying to get property of non-object in
- Issue with Woocommerce and extra field in orders data
- Is it possible to hide certain products from displaying in the search results
- Woocommerce ajax search can’t work on mobile
- Getting the gallery images from products in woocommerce?
- Get product details by url key in WordPress woocommerce
- Where is the “default attribute” values located in the phpMyAdmin in Woocommerce?
- Reverse engineering of WooCommerce Storefront filters
- Use WooCommerce function in other WordPress plugin
- WooCommerce – update order item price and recalculate totals
- Add product description (content) to WooCommerce customer processing order email
- Woocommerce: How to remove page title from storefront theme homepage
- Remove checkout fields with Woocommerce depending on one of several shipping methods
- Replace one coupon to another after coupon added
- WooCommerce Multi-Currency shortcode not working
- How to unset fields in woocommerce product quick edit?
- rating, share and review issue for single WooCommerce page
- Custom PLU field in woocommerce email
- Change how the Subtotal Price in cart being calculated [closed]
- Display Advanced Custom Fields value in Woocommerce admin order details
- Some images aren’t shown on wordpress after installation on host
- Show only one variaton in catalog on meta key
- WordPress & WooCommerce: Localhost, Staging and production environments and how to sync them without losing data
- PayPal Express on product page in WooCommerce – doesn’t seem to work on product page?
- Woocommerce – Want to block a user agent from accessing specific product pages
- Reset all stock status in woocommerce
- Additional fields on Woocommerce’s rating system
- Woocommerce product image [closed]
- Question on WooCommerce Syntax
- Tax are not showing on order while placing order with REST API
- woocommerce_new_product action doesn’t fire
- Change The Woocommerce Product Categories Dropdown Widget Placeholder Text
- minimum order item for certain products exempting 2 other products (in bulk)
- Is it possible to checkout with 2 different shipping options on a single order? [closed]
- Undo WooCommerce CSV import
- Simple Product not displaying in frontend
- Woocommerce Advanced Shipping (WAS) condition is not being called when selecting “Ship to different address” [closed]
- Strip string from $_product->get_title() to get a cleaner mini-cart
- WooCommerce Meta
- WooCommerce Product Table Conditional styling
- Product page attributes dropdown show price
- Smart Design for Blog + Woocommerce + LearnDash + Forum/Bodyboss
- Ajax add to cart not updating Elementor mini cart totals
- Dynamic product total add to cart amount
- How can I make a thumbnail slider
- WooCommerce – 500k Jump in Order Number?
- How to show specific admin menu to specific user role?
- Need help with woocommerce roles
- Change WooCommerce product and variation prices programatically without affecting performance
- Help to locate a woocommerce hook method
- How to exclude woocommerece product category in search results?
- I can’t add pictures to the product attribute item in woocommerce
- Can I use taxonomies to make a multistore with woocommerce?
- Why does wc_get_products($arg) return no products when $arg = ‘average_rating’ => 5.0
- woocommerce_sessions – Table does not exist
- How update price for variable product
- Woocommerce add 15% discount to a product if quantity is greater than or equal to 6
- Related products based on keywords
- Hide add to cart when product variation has no price or is unavailable
- How to get the WooCommercer product variation image
- how add css class to product boxes li, for img, add cart button, decs, price… [closed]
- How can I hide the entire “Shipping Details” block on the admin side of Woocommerce? [closed]
- How do I put woocommerce cart page to my checkout page? [closed]
- CSS url rules not relative to css path in account endpoint areas. IE. subscriptions
- Add Additional 3 buttons next to “Add to cart” button in woocommerce product page
- How do I remove the recurring total from thank you for your order email?
- Display product categories + child-categories on a single product page
- I want to Display custom woocomerce meta box in orders list