Merge pull request #21749 from woocommerce/fix/21746
Fix get_cart_from_session infinite loop
This commit is contained in:
commit
b282ea9e89
|
@ -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() ) );
|
||||
|
|
|
@ -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() );
|
||||
|
|
Loading…
Reference in New Issue