First I would state that in most cases the query_posts
should be avoided!
This function will completely override the main query and isn’t
intended for use by plugins or themes. Its overly-simplistic approach
to modifying the main query can be problematic and should be avoided
wherever possible.
I would suggest transfer your query with WP_Query and try something like this:
$all_prods = array(
'posts_per_page' => -1,
'post_type' => 'product',
);
$query = new WP_Query($all_prods);
while ($query->have_posts()) {
$query->the_post();
$post_id = get_the_ID();
echo $post_id;
}
For the Debug part, I would use the get_post($post_id);
to verify that we talk about the same post_type.
Related Posts:
- WP_Query: Exclude hidden products from WooCommerce product list
- How to query only for products with status “in stock” in WooCommerce? [closed]
- Query WooCommerce orders where meta data does not exist
- WP_Query for WooCommerce Products
- Changing a theme’s search function to only show results from woocommerce?
- Get WooCommerce best selling products for the current month [closed]
- Woocommerce query by price range and custom meta key
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- Retrieve products with specific attribute and in category – woocommerce
- How to combine tax_query and date_query in WordPress
- how to retrieve specific product attribute value in an sql query?
- Find all product that contain terms with %keywords% in WP_Query
- Display featured products through custom loop in WooCommerce 3 [closed]
- WP Query – Get WooCommerce Products with variation that is in stock
- Search product by brand name in wp_query
- Get product list of given category
- How to exclude products by tag from woocommerce shop page?
- WooCommerce Only OnSale Products Loop Snippet [closed]
- How to get the WC_Product Object when using a WP_Query in WooCommerce
- Extending woocommerce admin product search
- merge two query arguments into one WP_Query call
- Woocommerce returns Product post_status as published even tho it is in status draft
- WC displaying products from category
- showing all search result in one template
- Get all products which have both product category
- Woocommerce query all products and categories
- Take all produts by category
- Sort by price woocommerce by ID post_meta
- How to get all product attributes for filters in WooCommerce?
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- WP_QUERY to display woocommerce products whose author IS the logged in user
- Extend product search with meta in WooCommerce
- WooCommerce – get product sub categories
- Having trouble with WooCommerce Storefront child theme single.php “related posts” modification [closed]
- Woocommerce – Changing the order of the upsell products [closed]
- Out Of memory issue on post per page parameter
- Woocommerce – exclude only older out-of-stock items
- Need Sub-category with main Category
- Woocommerce pagination and result count after custom loop
- How to query woocommerce product by pricing? [closed]
- How to order WP_Query to group results?
- Can’t fetch Custom Post Type Data through Custom Query
- Redirect Search to Form When No Product Results Are Found
- How do I get Woocommerce product variation name and variation description in a WP_Query?
- 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
- Multiple meta_key ordering with pre_get_posts
- How to echo woocommerce category name
- Assign a minimum result count for WooCommerce query shortcodes?
- Woocommerce: order posts by meta key
- var_dump of WP_Query object is not empty, while .have_posts() return false
- WP_Query for products always returns empty
- Unlimited Page Sitemap Link
- $wp_query->found_posts not returning correct value
- Tax Query on product_cat using NOT IN as operator does not exclude that category
- Woocommerce Shortcode which displays a table with product data
- Make a products only viewable to a specific user ID in meta_query pre_get_posts
- Customize the Sorting Dropdown in WooCommerce use another list or more page
- ElasticPress is (aparently) messing with my search filters
- Woocommerce Get Orders By Meta Value
- Save large WP_Query to transient === false
- Custom Woocommerce Product Query
- WooCommerce WP_Query using tax_query returns no results (0 = 1)
- How sort products by calculate value? ( custom post meta, price, option)
- wc_get_products() return empty object
- How can I filter products by meta in Woocommerce REST API?
- WooCommerce. How To Exclude Subcategory Products From Category Listing Page
- get_posts return only first result
- What code to use in an array to call the current sub-category?
- Get categories within specific term
- Select multiple categories with is_tax
- How to display Woocommerce products list by tag
- Woocommerce featured products query no longer working
- Ajax buttons not working properly in WooCommerce when using wc_get_template_part
- update_post_meta performance in a loop woocommerce
- update_post_meta performance in a loop woocommerce
- Query child posts with tax query on parents
- Woocomerce – Order products by float attribute in archive pages
- Not able to fetch woocommerce variation sales products for particular category products
- Slow Query with more 100 products
- Create global array to compare inside a query
- Get posts with any value in attribute
- How do i query woocommerce booking post type on init action?
- WP_Query to Retrieve Posts from WooCommerce Products that are Only in Catalog
- How to add in WP_Query to every 3 posts displayed? [duplicate]
- Woocommerce WP_Query post__not_in problem
- Using the same WP_Query for shop and widgets in WooCommerce shop
- Woocommerce orderby rand with tax_query not random
- Adding arguments to WooCommerce Product Loop using AJAX
- Show linked products using wp query and woocommerce
- Filtering product search results using tags
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise
- Variations as Single Products [closed]
- WP_Query (or WC_Product_Query) out of memory
- Query custom post type by custom taxonomy (category slug)
- Especific order by Custom Field Values in WP_Query
- Date not appearing in custom query
- wp_insert_post with ACF Fields and WP Meta Query returns no rows until update