get_posts only getting most recent product
I had a website built on Woocommerce for me, but no longer have access to the Developer. I'm not a programmer so anything beyond CSS changes gives me quite a bit of problems. There is a piece of code that was working fine, but I have added an additional item to the site and now it only will fetch the most recent item added. I believe the problem is that get_posts is only collecting the latest product and I need it to collect all of them. Pretty sure I've narrowed it down to these two lines:
$products = get_posts(array('post_type' = 'product'));
$product = wc_get_product($products[0]-ID);
Does this need a loop? Sorry, I'm really not equipped to deal with this and it's really hard to find someone who can help me with a single question like this.
Topic woocommerce-offtopic get-posts Wordpress
Category Web