Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Web-user

    (@web-user)

    Hi,
    After updating to Woocommerce 3.x, wc_get_product does not work.
    I want to get product title, content and I use below code;

    $object = wc_get_product( $ID );
    $data = get_post_meta( $ID );
    
    $product['ID'] = $ID;
    $product['object'] = $object;
    $product['status'] = $object->post->post_status;
    $product['author'] = intval( $object->post->post_author );
    
    $product['content'] = $object->post->post_content;
    $product['title'] = $object->post->post_title;

    Notice: post was called incorrectly. Product properties should not be accessed directly. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/yours-commercial-network/template-shop-products.php’), WooClass::getProduct, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong Please see Debugging in WordPress for more information. (This message was added in version 3.0.) in www/wp-work-theme.loc/wp-includes/functions.php on line 4137

    Web-user

    (@web-user)

    Hi,After updating to Woocommerce 3.x, wc_get_product does not work.
    I want to get product title and content and I use below code;

    $product = array();
    $object = wc_get_product( $ID );
    
    $product['ID'] = $ID;
    $product['object'] = $object;
    $product['status'] = $object->post->post_status;
    $product['author'] = intval( $object->post->post_author );
    
    $product['content'] = $object->post->post_content;
    $product['title'] = $object->post->post_title;

    Notice: post was called <strong>incorrectly</strong>. Product properties should not be accessed directly. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/yours-commercial-network/template-shop-products.php'), WooClass::getProduct, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong Please see <a href="https://codex.ww.wp.xz.cn/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 3.0.) in www/wp-work-theme.loc/wp-includes/functions.php on line 4137

    • This reply was modified 9 years ago by Web-user.
    • This reply was modified 9 years ago by Web-user.
    Web-user

    (@web-user)

    Hi guys, I have a problem
    woocommerce Notice: order_date was called incorrectly. Order properties should not be accessed directly

    help me please !

Viewing 3 replies - 1 through 3 (of 3 total)