session && ! wc_has_notice( $html, 'error' ) ) { wc_add_notice( $html, 'error' ); } return false; } /** * Order again empties the cart before it validates the order's items * (`woocommerce_empty_cart_when_order_again`, default true). While * add-to-cart is blocked nothing will be added, so keep the shopper's * current cart instead of emptying it. * * @param mixed $empty_cart Whether to empty the cart. * @return mixed */ public static function keep_cart_on_order_again( $empty_cart ) { if ( ! $empty_cart ) { return $empty_cart; } return OrderingPolicy::check( Situation::CONTEXT_ADD_TO_CART )->is_blocked() ? false : $empty_cart; } }