title: Extending the woocommerce rest api
body: <p>I would like to extend the woocommerce rest api to include data of its 'booking' extension plugin. Currently this extension does not have default endpoints provided by the rest api. </p>
  
  <p>So far I have created a plugin, and I've added the following code;</p>
  
  <pre><code>add_filter( 'woocommerce_rest_prepare_product', 'custom_data');
  
  function custom_data($response, $object) {
          if( empty( $response-&gt;data ) )
              return $response;
  
          $response-&gt;data['meta_data'] = get_post_meta( $object[ID], 'availability', true);
          return $response;
      }
  </code></pre>
  
  <p>When I call the end point <code>/products</code> only the default data outlined by woocommerce is still called my little add on is no where to be found. </p>
  
  <p>I don't even know where to find the above filter as I just saw this posted on a webpage and I tried to get it to do what I wanted, don't know if this is the correct direction to go down either. Webpage: <a href="https://francescocarlucci.com/woocommerce/woocommerce-api-custom-data-default-endpoints/#more-96" rel="noreferrer">https://francescocarlucci.com/woocommerce/woocommerce-api-custom-data-default-endpoints/#more-96</a></p>
  
  <p>The above was me trying to extend the api but I also decided to try making a custom endpoint to see if I can get my desired outcome but so far I've just made a endpoint which calls but I have no idea what to write to retrieve the data I want. </p>
  
  <p>custom end point code: </p>
  
  <pre><code>function register_custom_route() {
              register_rest_route( 'ce/v1', '/bookable',
                    array(
                      'methods' =&gt; 'GET',
                      'callback' =&gt; 'get_bookable'
                    )
            );
          }
  
  
          function get_bookable( ) {
              return array( 'custom' =&gt; 'woocommerce here' );
  //What code do I write here :(
  
          }
  </code></pre>
  
  <p>Is there anyway I can achieve what I want under one of the above methods? 
  I'm quite new to dev and I'm familiar with javascript not PHP hence my need to want to use the rest api as I would like to use wordpress/woocommerce as a headless cms. </p>
  
  <p>So far the closets example I've come to has been shown on this question <a href="https://stackoverflow.com/questions/53626874/creating-woocommerce-custom-api?noredirect=1#comment95583817_53626874">Creating WooCommerce Custom API</a></p>