WordPress at Your Fingertips
function is not described

WC_Product_Data_Store_CPT::read() public WC 1.0

Method to read a product from the database.

{} It's a method of the class: WC_Product_Data_Store_CPT{}

Hooks from the method
Return

null. Nothing.

Usage

$WC_Product_Data_Store_CPT = new WC_Product_Data_Store_CPT();
$WC_Product_Data_Store_CPT->read( $product );
$product(WC_Product) (required) (passed by reference — &)
Product object.

Code of WC_Product_Data_Store_CPT::read() WC 5.7.1

public function read( &$product ) {
	$product->set_defaults();
	$post_object = get_post( $product->get_id() );

	if ( ! $product->get_id() || ! $post_object || 'product' !== $post_object->post_type ) {
		throw new Exception( __( 'Invalid product.', 'woocommerce' ) );
	}

	$product->set_props(
		array(
			'name'              => $post_object->post_title,
			'slug'              => $post_object->post_name,
			'date_created'      => $this->string_to_timestamp( $post_object->post_date_gmt ),
			'date_modified'     => $this->string_to_timestamp( $post_object->post_modified_gmt ),
			'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,
			'post_password'     => $post_object->post_password,
			'reviews_allowed'   => 'open' === $post_object->comment_status,
		)
	);

	$this->read_attributes( $product );
	$this->read_downloads( $product );
	$this->read_visibility( $product );
	$this->read_product_data( $product );
	$this->read_extra_data( $product );
	$product->set_object_read( true );

	do_action( 'woocommerce_product_read', $product->get_id() );
}