I got this solution from https://stackoverflow.com/a/57218305/900557
Add this to your theme’s functions.php
The Answer from Chandrakant Devani helped, but broke other searches in the admin. Adding an if seems to avoid breakages
if ( is_admin() && $query->is_main_query() && $query->query_vars['post_type'] == 'product')
full code:
add_action( 'pre_get_posts', 'products_pre_get_posts' );
function products_pre_get_posts( WP_Query $query ) {
if ( is_admin() && $query->is_main_query() && $query->query_vars['post_type'] == 'product' ) {
$query->set( 'tax_query', array(
array(
'taxonomy' => 'product_cat',
'field' => 'term_id',
'terms' => get_terms( array( 'taxonomy' => 'product_cat', 'fields' => 'ids' ) )
)
) );
}
}
I don’t know enough about woocommerce to know why this is needed, but it fixed our problem
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
- if statement for search results
- Separeting product from post in search result
- Woocommerce custom search
- 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
- 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
- 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
- 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
- Notice: Trying to get property of non-object in
- How can I change my search form to bring up product results, not blog results
- Is it possible to hide certain products from displaying in the search results
- Woocommerce ajax search can’t work on mobile
- WooCommerce: Can’t use wc_get_products for custom REST API endpoints
- How to remove an action within a class with extends
- Display WooCommerce size product attribute on shop page
- Query multiple post type and categories
- Shipping restrictions with WooCommerce variable products
- woocommerce_before_calculate_totals in woocommerce 3.0
- Custom URL for each product variation – rewrite rules
- Display a list subcategories under the main product category thumbnails?
- Unable to programmatically remove product from WooCommerce cart
- creating product with variations using woocommerce REST API
- How to Change WooCommerce Variable product pricing by SKU or visible children id
- Is it possible to cache ?wc-ajax=get_variation
- Adding extra one email address who receives email as admin – woocommerce
- Woocomerce language
- How to set default values in Woocommerce checkout? [closed]
- Display list of categories that contain products with a specific tag
- Payment methods are not displaying in Woocommerce
- How to display empty stars on products with woocommerce?
- Product admin page breaking with too many product variations [closed]
- Add content to the last slide of each product
- Remove add to cart icon/view product button woocommerce
- Product options/variations notice displays as an Alert [closed]
- Expired session error (admin) when I try to make a call to WooCommerce api [closed]
- Hide decimal on hompage, category and product page
- Get order_id from the product_id in woocommece [closed]
- Shipping methods in dropdown instead of radio buttons [closed]
- 600k of option_name “c_facebook_background_product_sync_job”
- Woocommerce get the Archive/Category slug of the current category page
- Woocommerce Variable Product – Please choose product options… [closed]
- Woocommerce. Max weight per order based on shipping class
- Make order notes field at woocommerce checkout only viewable on front end by Admin level user role [closed]
- How to apply these filters
- Woocommerce – auto logout after payment
- Display SKU for each Single product title in group product!
- How can I add a so i can show sale price under normal price
- WooCommerce checkout page price break down table hook
- Using the WordPress and WooCommerce REST APIs in the same Node app
- Next/Previous Product with custom order by price & products inside the product category [closed]
- Submitting product attributes via Ninja Forms wordpress?
- Migrating WordPress + WooCommerce from server to Local
- wp-cron and woocommerce subscriptions killing performance
- How to Add “parent category description” in Woocommerce sub category page if there is no description available for child category
- Woocommerce – Hide shipping at all, if only certain product or products with certain shipping class is in the cart
- Running JavaScript after using WooCommerce Filter Plugin
- Woocommerce product query not working in other WPML languages
- How to use decimal in quantity fields in WooCommerce for certain categories?
- Getting WordPress fatal error when hitting WooCommerce API
- Adding Tracking Details for Advanced Shipment Tracking Plugin From Order Notes
- check shipping amount in woocommerce_after_checkout_validation?
- How to display woocommerce product details on wp page
- how i can limit woo Category number like as ‘posts_per_page’ => -1, but it cannot work please help me
- Update a list of product to featured if product have meta value (Mysql not wpquery)
- How to set up dynamic purchase pixel in Woocommerce?
- Forgot password flow does not work, getting email with a link but after clicking link it’s not working
- Html code is not showing in woocommerce shop page on adding in header.php?
- Is this code collecting user password?
- Select all products that have a custom field ‘is_new’ set to ‘Yes’
- Removing Product from Woocommerce checkout page using Ajax
- add_post_meta on subcription renewal
- Replace product link with just product name on WooCommerce downloads page
- Importing Attributes in to Woocommerce
- woocomerce products and categories don’t display fixed
- Update Custom Post Meta Even if Draft
- Clone and modify Woocommerce Products catalog
- Update order status based on condition
- How to add ajax loading icon after click add to cart button on woocommerce
- WooCommerce Table Rates not splitting up
- How can I let the user choose size of a shoe in the store? [closed]
- Hide/show specific products for backend users in woocommerce
- I’d like to add a button under the “Add to Cart” button which says “Buy on Amazon” and links to my Amazon product page [closed]
- If YITH Wishlist page is set to the WooCommerce my-account endpoint, the endpoints stop working all together. Any solution?
- WooCommerce pay per photo upload [closed]
- Override woocommerce template from parent theme
- WooCommerce – How to add a custom field to only a specific email template [closed]
- Hide price, “add to cart” button and show message “Please log in to shop” [closed]