Prime cache to reduce queries per cart item

This commit is contained in:
Mike Jolley 2016-02-09 23:36:15 +00:00
parent 114cbdd450
commit 8fd336cb0e
1 changed files with 3 additions and 0 deletions

View File

@ -223,6 +223,9 @@ class WC_Cart {
}
if ( is_array( $cart ) ) {
// Prime meta cache to reduce future queries
update_meta_cache( 'post', wp_list_pluck( $cart, 'product_id' ) );
foreach ( $cart as $key => $values ) {
$_product = wc_get_product( $values['variation_id'] ? $values['variation_id'] : $values['product_id'] );