title: PHP (wordpress) API Returning Empty Arrays
body: <p>I've created my endpoint and I'm trying to return products in a category, however  the return statement returns empty curly brases, whereas, if I do <code>var_dump($all_products)</code>, I get my full data.</p>
  <pre><code>                    $product_categories = get_terms( 'product_cat', $cat_args );
                      foreach ($product_categories as $key =&gt; $category) {
                          $myslugs = $category-&gt;slug.', ';
                          
                      }
                      
                      $all_products = wc_get_products(array(
                                                  'category' =&gt; array($myslugs)
                                              ));
                     
                      $response = new WP_REST_Response( $all_products, 200);
                      return $response;
                       
  </code></pre>