You will have to change your tax_query. The xs
is not the term_id
but the slug
So your tax_query will end up being like
'tax_query' => array(
array(
'taxonomy' => 'pa_sizes',
'field' => 'slug',
'terms' => 'xs'
)
)
I would love to help with the “instock” problem too, but I’m stuck with that question too.
Related Posts:
- Query WooCommerce orders where meta data does not exist
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- Extending woocommerce admin product search
- Extend product search with meta in WooCommerce
- Multiple meta_key ordering with pre_get_posts
- How to echo woocommerce category name
- ElasticPress is (aparently) messing with my search filters
- Woocommerce Get Orders By Meta Value
- WooCommerce WP_Query using tax_query returns no results (0 = 1)
- How to get products with the same custom attribute like ean code
- Get posts from multiple tax terms
- meta_query fails to compare on values containing apostrophes
- How to Order a list of taxonomies? orderby?
- meta queries do ‘either/or’ checks
- How to set up hierarchical relationships without using plugins / meta query
- How to add custom meta to ‘pre_get_terms’?
- WP Query ordering on a meta field for posts with a date in the future not ordering by datetime
- Can’t fetch Custom Post Type Data through Custom Query
- Is this meta query problematic?
- WP Query Meta Value – How To Identify Specific, Unique Values?
- Selecting posts with a given meta value for a meta key
- Get Child Category only
- Redirect Search to Form When No Product Results Are Found
- Order by meta_key doesn’t work
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- How do I get Woocommerce product variation name and variation description in a WP_Query?
- Check if searched number is within the post meta value
- Meta query compare for ID’s greater than specific ID
- Appending to existing WP_Query’s meta_query if exists
- WP_Query Taxonomy categories filtering
- Exclude a Woocommerce product from WP_Query
- Hide products in uncategorized category from search results
- Woo Commerce using WP_Query to get products that match price range, with an additional required product attribute
- Issues with search after added meta_query
- Sort by presence of thumbnail
- Display posts with specific value first in query
- Get every post with value in meta key
- Get posts in taxonomy randomly
- Loop posts based on permalink term
- it’s possible make a WP_Query with math operations?
- Sorting search results with custom dropdown
- get_page meta query not working, maybe a bug?
- WP_Query: apply an SQL function to meta fileld value
- Assign a minimum result count for WooCommerce query shortcodes?
- How to search for meta_query LIKE or tax_query LIKE and grab these posts on search results?
- How to create dynamic value in WP_Query meta_query
- Is it possible to add relation between meta_query and tax_query?
- Woocommerce: order posts by meta key
- Get meta_value of a specific meta_key from all posts belonging to a specific custom type
- Custom query filter by ACF date custom field
- Query by date from custom field
- var_dump of WP_Query object is not empty, while .have_posts() return false
- WP Query – filtering terms with regex
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- query post by author gender
- Nested array issue in meta_query
- WP_Query for products always returns empty
- How to get posts by category and by choosing a taxonomy term?
- Error in meta_query not get result
- add_query_arg to compare and display events from a certain date
- How do I add an item to the WP admin menu?
- Multiple meta query from array
- Meta query with compare by more than 2 fields
- Show single posts date, in a page of posts
- Comparing 2 Decimal Numbers from custom fields and displaying posts
- Unlimited Page Sitemap Link
- How to get current page nearest parent id?
- relation OR instead of AND – Filtered term ID’s in loop
- WP Query / Meta Query [duplicate]
- Don’t repeat posts from children in parent taxonomy query
- meta_query with array as value with multiple arrays
- Why doesn’t my WP Meta Query return any results?
- Query posts by searching for a string in a meta field
- WP_Query with 4 post meta field arguments gives 500 internal server error
- WP_Query meta compare must include ALL array values
- WP_Query Class custom field parameters
- meta_query returning excluded result
- Show multiple tax_query from 2 or more post_type in a single code
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- Custom taxonomy in WP_Query not working
- WP_Query not returning correct result with meta_query parameter
- What’s missing in this wp_query and meta_query
- Sort posts using multiple custom fields and menu_order in single query?
- meta_query where the meta value is not the post title
- $wp_query->found_posts not returning correct value
- get_the_terms has strange result since version 6.0
- meta_query weird behaviour, static int will work, but not user data
- Can’t get term id for category archive
- How to make a post with certain taxonomy term display first before other post with only one query?
- Query multiple post types, but different order for each
- How to add date_query to meta_query array
- Order by the first array within a meta_query
- Order WP_Query by meta_key priority when ‘OR’ relation used for multiple meta values
- Exclude post with taxonomy and from the terms (taxonomy & tag) posts count
- Tax Query on product_cat using NOT IN as operator does not exclude that category
- Woocommerce Shortcode which displays a table with product data
- Query ACF relationship field – Comparator IN – Value array
- Use get_cat_ID to retreive multiple category IDs
- Creating a query that get all posts but places meta items first
- Strange behaviour of hierarchical taxonomy archive