title: Fatal error: Call to a member function get_id() on boolean
body: <p>In my wordpress website I getting below error</p>
  <pre><code>Fatal error: Call to a member function get_id() on boolean in /home/customer/www/ae.testing.com/public_html/wp-content/themes/movedo-child/functions.php on line 33
  </code></pre>
  <p>Previously working fine . but now what exact issue i am not getting. if any one have idea then let me know</p>
  <p>function.php as follows:</p>
  <pre><code>&lt;?php
  function movedo_child_theme_setup() {
  }
  add_action( 'after_setup_theme', 'movedo_child_theme_setup' );
  
  
  function display_price_in_variation_option_name( $term ) {
     echo  $product = wc_get_product();
      $id = $product-&gt;get_id();
      if ( empty( $term ) || empty( $id ) ) {
          return $term;
      }
      if ( $product-&gt;is_type( 'variable' ) ) {
          $product_variations = $product-&gt;get_available_variations();
      } else {
          return $term;
      }
  
      foreach($product_variations as $variation){
          if(count($variation['attributes']) &gt; 1){
              return $term;
          }
          foreach($variation['attributes'] as $key =&gt; $slug){
              if(&quot;attribute_&quot; == mb_substr( $key, 0, 10 )){
                  $taxonomy = mb_substr( $key, 10 ) ;
                  $attribute = get_term_by('slug', $slug, $taxonomy);
                  if($attribute-&gt;name == $term){
                      $term .= &quot; (&quot; . wp_kses( wc_price($variation['display_price']), array()) . &quot;)&quot;;
                  }
              }
          }
      }
      
      return $term;
  
  }
  add_filter( 'woocommerce_variation_option_name', 'display_price_in_variation_option_name' );
  </code></pre>
  <p>On line &quot;<strong>$id = $product-&gt;get_id();</strong>&quot; I m getting this error.</p>