Get all products (or by collection) into array

I’m trying to create a button that adds 1 of each products I have to cart. Found the great function:
$w(‘#shoppingCartIcon’).addProductsToCart( [selectedProducts] )

But I cannot fill the array selectedProducts with the products.
I need to be able to add all products, but also all products from e.g. collection NNN.

Appreciate the help!

Looks like this is the answer. Found example with explanation here: https://www.wix.com/corvid/example/dynamic-slideshow

function getProductshowDataFromDatabase() {
	return wixData.query("Stores/Products").find().then(results => {
		return results.items;
	})
}