Hello @ashrafkotb!
Can you please try the suggestions of this page and see if it solves the issue? → https://www.businessbloomer.com/woocommerce-solving-cart-empty-issue/
Thanks for your reply Mashi. The link is a guide to a different problem (the cart is not being updated).
My issue is different. The cart gets updated when adding a product. However, when I try to remove a product from the cart, I get that dummy page in the screenshot above.
I want to bypass this notice and get a refreshed version of the cart.
The correct view I want to get after removing the item from the cart would look like this: https://ibb.co/QD3XF60
-
This reply was modified 3 years, 7 months ago by
ashrafkotb.
Hi @ashrafkotb
Thanks for clarifying.
Whenever the user removes an item from the cart, they are getting a dummy page that breaks the theme
Can you please check if the solution provided on this StackOverflow thread work for you?
https://stackoverflow.com/questions/55225439/getting-an-error-when-trying-to-remove-a-cart-item-from-the-woocommerce-checkout
If it doesn’t help then in order to check your configuration and assist you further, could you please share the following:
- System Status: You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”. Once you’ve done that, paste it here in your response.
- Fatal Error Log: Share a copy of any fatal error log found under WooCommerce > System Status > Logs (if available).
We’ll look forward to hearing from you.
I think this is a bit different from what I’m trying to achieve. I found something very close to what I want to achieve, but it seems it needs to be reviewed for the latest version. I tried to use it as is, but the notice still appears.
function remove_added_to_cart_notice()
{
$notices = WC()->session->get('wc_notices', array());
foreach( $notices['notice'] as $key => &$notice){
if( strpos( $notice, 'whilst' ) !== false){
$BadNotice_key = $key;
unset( $notices['notice'][$BadNotice_key] );
WC()->session->set('wc_notices', $notices);
break;
}
}
unset( $notices['notices'][$added_to_cart_key] );
WC()->session->set('wc_notices', $notices);
}
add_action('woocommerce_before_single_product','remove_added_to_cart_notice',1);
add_action('woocommerce_shortcode_before_product_cat_loop','remove_added_to_cart_notice',1);
add_action('woocommerce_before_shop_loop','remove_added_to_cart_notice',1);
Could you please check the above and let me know if it needs any changes?
Hi @ashrafkotb,
Did you try hiding the notice with CSS? That said, please note that we do not provide support for customizations on this forum. You may want to share your website’s URL and I’ll leave this thread open for a bit to see if anyone is able to chime in to help you out.
You can consult with customization experts listed at https://woocommerce.com/customizations/.
You can also visit the WooCommerce Facebook Community group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.
Cheers.
Seems we’ve not had additional inputs on this thread. Thus, we encourage you to make use of the above resources.
I’ll go ahead and mark the thread as resolved but please feel free to create a new thread if you have further questions.