• Resolved simooo

    (@simooo)


    Hi there,

    Shouldn’t a WC_Product_Simple object inherit functions like get_name() and get_price_html()?

    https://docs.woocommerce.com/wc-apidocs/class-WC_Product_Simple.html

    I’m trying to display a product in a custom template file that I am including from cross-sells.php.

    $product seems to be a legit WC_Product_Simple object in my template file and I can extract the title using $product->post->post_title, but I need some of the formatting functions and it seems to me that they should be available.

    When trying to call get_name() I’m getting this error:
    PHP Fatal error: Uncaught Error: Call to undefined method WC_Product_Simple::get_name()

    Thanks!

    Simon

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WC_Product_Simple not inheriting parent functions’ is closed to new replies.