Skip to content

Commit

Permalink
wpcom_add_shopping_cart: Use new is_cart_empty function
Browse files Browse the repository at this point in the history
  • Loading branch information
mreishus committed Sep 27, 2024
1 parent 3490099 commit 3a7a623
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,15 @@ function wpcom_add_shopping_cart( $wp_admin_bar ) {
// Get the current blog ID.
$blog_id = get_current_blog_id();

// Retrieve the current user's shopping cart for the current blog.
$cart = \Store_Shopping_Cart::get_existing_cart(
$is_empty = \Store_Shopping_Cart::is_cart_empty(
array(
'blog_id' => $blog_id,
'user_id' => get_current_user_id(),
)
);

// If the cart is empty (no products), do not add the cart menu.
if ( ! $cart->get_product_slugs() ) {
if ( $is_empty ) {
return;
}

Expand Down

0 comments on commit 3a7a623

Please sign in to comment.