Prime term cache before read
This commit is contained in:
parent
5ffff712e7
commit
e06aa6f60a
|
@ -283,6 +283,9 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
|
|||
$product->set_average_rating( $average_rating );
|
||||
}
|
||||
|
||||
// Prime the cache.
|
||||
update_object_term_cache( $id, 'product' );
|
||||
|
||||
$product->set_props( array(
|
||||
'sku' => get_post_meta( $id, '_sku', true ),
|
||||
'regular_price' => get_post_meta( $id, '_regular_price', true ),
|
||||
|
|
|
@ -261,6 +261,10 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
|
|||
*/
|
||||
protected function read_product_data( &$product ) {
|
||||
$id = $product->get_id();
|
||||
|
||||
// Prime the cache.
|
||||
update_object_term_cache( $id, 'product_variation' );
|
||||
|
||||
$product->set_props( array(
|
||||
'description' => get_post_meta( $id, '_variation_description', true ),
|
||||
'regular_price' => get_post_meta( $id, '_regular_price', true ),
|
||||
|
|
Loading…
Reference in New Issue