Question: In one shop the following function throws a fatal error. What does the error tell me exactly?

The function: 

```
$product = wc_get_product( $product_id );
$price = $product->get_price();

```

The error:

```
Fatal error: 
Uncaught Error: Call to a member function get_price() on boolean in 

```

Does this mean that I get a boolean back instead of a string or number? The error is coming from the line where I invoke get\_price()

Answer: 
One way to fix this is to check the class you expect before calling the expected function

```
$product = wc_get_product( $product_id )
if( $product instanceof WC_Product )
{
  $price = $product->get_price();
}

```

at which pointn you could add either futher logic or throw an error.
If `$product` is a boolean then this line

```
$product = wc_get_product( $product_id );

```

has failed !

You might start by checking what is in `$product_id`