For a custom plugin I want a full list of all products we have in WooCommerce. So, I found this code, but it shows only 10 results, instead of all products.

$loop = new WP_Query( array('post_type' => 'product', 'post_per_page' => -1));

What is the right loop to get all products?

Read more here: WordPress get all products


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: