WC_Product_Data_Store_CPT::read PHP Method

read() public method

Method to read a product from the database.
public read ( &$product )
    public function read(&$product)
    {
        $product->set_defaults();
        if (!$product->get_id() || !($post_object = get_post($product->get_id()))) {
            throw new Exception(__('Invalid product.', 'woocommerce'));
        }
        $id = $product->get_id();
        $product->set_props(array('name' => get_the_title($post_object), 'slug' => $post_object->post_name, 'date_created' => $post_object->post_date, 'date_modified' => $post_object->post_modified, 'status' => $post_object->post_status, 'description' => $post_object->post_content, 'short_description' => $post_object->post_excerpt, 'parent_id' => $post_object->post_parent, 'menu_order' => $post_object->menu_order, 'reviews_allowed' => 'open' === $post_object->comment_status));
        $product->read_meta_data();
        $this->read_attributes($product);
        $this->read_downloads($product);
        $this->read_product_data($product);
        $product->set_object_read(true);
    }