title: Global $product is null - Timber + Woocommerce
body: <p>I've followed this guide to integrate Woocommerce into Timber:
  <a href="https://timber.github.io/docs/guides/woocommerce/" rel="nofollow noreferrer">https://timber.github.io/docs/guides/woocommerce/</a></p>
  
  <p>I've also included this in <code>functions.php</code></p>
  
  <pre><code> add_action( 'after_setup_theme', 'add_woocommerce_support' );
  
   function add_woocommerce_support() {
          add_theme_support( 'woocommerce' );
      }
  </code></pre>
  
  <p>My <code>woocommerce.php</code> is exactly the same as the one in the guide:</p>
  
  <pre><code>&lt;?php
  
  if ( ! class_exists( 'Timber' ) ){
      echo 'Timber not activated. Make sure you activate the plugin in &lt;a href="/wp-admin/plugins.php#timber"&gt;/wp-admin/plugins.php&lt;/a&gt;';
  
      return;
  }
  
  $context            = Timber::get_context();
  $context['sidebar'] = Timber::get_widgets( 'shop-sidebar' );
  
  if ( is_singular( 'product' ) ) {
      $context['post']    = Timber::get_post();
      $product            = wc_get_product( $context['post']-&gt;ID );
      $context['product'] = $product;
  
      // Get related products
      $related_limit               = wc_get_loop_prop( 'columns' );
      $related_ids                 = wc_get_related_products( $context['post']-&gt;id, $related_limit );
      $context['related_products'] =  Timber::get_posts( $related_ids );
  
      // Restore the context and loop back to the main query loop.
      wp_reset_postdata();
  
      Timber::render( 'views/woo/single-product.twig', $context );
  } else {
      $posts = Timber::get_posts();
      $context['products'] = $posts;
  
      if ( is_product_category() ) {
          $queried_object = get_queried_object();
          $term_id = $queried_object-&gt;term_id;
          $context['category'] = get_term( $term_id, 'product_cat' );
          $context['title'] = single_term_title( '', false );
      }
  
      Timber::render( 'views/woo/archive.twig', $context );
  }
  </code></pre>
  
  <p>Yet, whenever I try to access a product page I'm getting this error</p>
  
  <pre><code>Fatal error: Uncaught Error: Call to a member function is_on_sale() on null in /app/wp-content/plugins/woocommerce/templates/single-product/sale-flash.php on line 30
  </code></pre>
  
  <p>Which means that the global <code>$product</code> is <code>null</code>.
  Adding <code>$product = wc_get_product($post-&gt;ID)</code> directly before the error line solves the issue but that's obviously not a workaround as I'd be modifying core files.</p>
  
  <p>Am I missing anything here?</p>