• Resolved raulvaquerizo

    (@raulvaquerizo)


    I’m trying to make an api call to this endpoint:
    wp-json/wc/v3/products?sku=xxxxxxxx
    And I receive an error:
    Fatal error: Uncaught Error: Call to a member function get_id() on null

    /home/u889150444/domains/xxxxx/public_html/wp-content/themes/worldofhappybay/functions.php on line 1099

    line 1099:
    $product_id = $product->get_id();

    With other SKU works well, and if i try with an incorrect sku I recive an empty response.

Viewing 1 replies (of 1 total)
  • Moderator threadi

    (@threadi)

    The mentioned line seems to be in a customised theme. As we do not know its source code, it is unfortunately not possible to give any precise tips.

    However, based on the question, I suspect that an attempt is being made to load a WooCommerce product at the point in question. This does not seem to work, which is why the message appears. Without knowing the source code, it is not possible to judge why this is happening. If you would like more specific support, please provide more details and contact the WooCommerce support forum if necessary: https://wordpress.org/support/plugin/woocommerce/

Viewing 1 replies (of 1 total)

The topic ‘Fatal error: Uncaught Error: Call to a member function get_id() on null’ is closed to new replies.