Merge pull request #21749 from woocommerce/fix/21746

Fix get_cart_from_session infinite loop
This commit is contained in:
Claudiu Lodromanean 2018-10-30 11:04:28 -07:00 committed by GitHub
commit b282ea9e89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -61,6 +61,7 @@ final class WC_Cart_Session {
* @since 3.2.0
*/
public function get_cart_from_session() {
do_action( 'woocommerce_load_cart_from_session' );
$this->cart->set_totals( WC()->session->get( 'cart_totals', null ) );
$this->cart->set_applied_coupons( WC()->session->get( 'applied_coupons', array() ) );
$this->cart->set_coupon_discount_totals( WC()->session->get( 'coupon_discount_totals', array() ) );

View File

@ -603,7 +603,7 @@ class WC_Cart extends WC_Legacy_Cart {
if ( ! did_action( 'wp_loaded' ) ) {
wc_doing_it_wrong( __FUNCTION__, __( 'Get cart should not be called before the wp_loaded action.', 'woocommerce' ), '2.3' );
}
if ( ! did_action( 'woocommerce_cart_loaded_from_session' ) ) {
if ( ! did_action( 'woocommerce_load_cart_from_session' ) ) {
$this->session->get_cart_from_session();
}
return array_filter( $this->get_cart_contents() );