Fix: WooCommerce messages don't appear in block themes with Mini Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/6728)

This commit is contained in:
Tung Du 2022-07-22 00:05:52 +07:00 committed by GitHub
parent 63ce706139
commit 02a3d27de6
1 changed files with 8 additions and 1 deletions

View File

@ -463,7 +463,14 @@ class MiniCart extends AbstractBlock {
* @return object;
*/
protected function get_cart_payload() {
return WC()->api->get_endpoint_data( '/wc/store/cart' );
$notices = wc_get_notices(); // Backup the notices because StoreAPI will remove them.
$payload = WC()->api->get_endpoint_data( '/wc/store/cart' );
if ( ! empty( $notices ) ) {
wc_set_notices( $notices ); // Restore the notices.
}
return $payload;
}
/**