woocommerce cart not empty

Description

This is Woocommerce Empty Cart extension which helps to make cart empty.

Screenshots

  • WooCommerce Backend Settings "General" page.
  • This is Front-End Empty Cart Page. By Clicking on that you can clean your cart.

Installation

1.Download the Netaxept Payment Gateway plugin zip file and extract to the /wp-content/plugins/ directory.
2.Activate the plugin through the ‘Plugins’ menu in WordPress Admin.

1.Download the Netaxept Payment Gateway plugin zip file and extract to the /wp-content/plugins/ directory.
2.Activate the plugin through the ‘Plugins’ menu in WordPress Admin.

Is it woo commerce supported?

Yes. It is a woo commerce plugin.

Do I need to install woocommerce plugin?

Yes, you should install woocommerce plugin first.

Woocommerce cart not empty

I have a problem in my Woocommerce shop. Not logged-in users can’t add products in their cart! When they press the "add-to-cart-button", the products is added to the cart. But if they refresh the page or go to the cart, it is empty!

If I am logged-in, it is not happening and everything is working good.

Can someone please help?

I think the problem is in your server configuration. If you use any caching plugin deactivate it and hard refresh your browser. Then check again if it works or not?

In case anybody else runs into this: hosting providers like WP Engine make extensive use of caching to improve the performance of your webshop. Although, they’re excluding pages where this is not desired, like the cart or checkout page.

They do this for the default paths (/cart, /checkout) only, though. So if you change the default path to adapt the URLs to your language of choice, for example, make sure to write to their support so they can add exceptions for your pages.

See here for a description of this issue from WP Engine.

I had this problem. For me, I realised it was because the session_id column in the wp_woocommerce_sessions table was not auto incrementing. After I modified the table, it worked.

It sounds like the website is behaving differently for logged in users vs. visitors – this won’t be affected by the “checkout without registering” option. This kind of problem is usually caused by either a conflict with your theme, Plugin or with Cache.

How to Check if the WooCommerce Cart is Empty

We had an interesting question the other day from a user who wanted to know if it’s possible to do something only when the WooCommerce cart is empty. WooCommerce core includes several handy methods that can help you out with this, but lots of tutorials show a cart-empty check with the $woocommerce global. However, this is only necessary if working with WooCommerce 2.0 or earlier. You can instead use the WC() global function to cut this down a bit with WooCommerce 2.1 or newer.

We can do our check by using the WC() global function and getting the cart contents count. While there are several ways we could check this, I prefer this method since it returns as an integer, so we simply need to check if it’s equal to zero to determine if the cart is empty.

That’s all you need to check if the WooCommerce cart is empty in your own snippet or plugin.

Let’s take a look at a real use-case. Suppose you want to show a notice in your store if the cart is empty – perhaps this could encourage a promotion or inform customers of coupon codes. It also works really well as a companion to our WooCommerce Cart Notices extension, as this displays notices if items are in the cart.

We’ll create a notice that will only display if there are no products in the cart, and you can determine where you’d like to display the notice (based on which actions you choose to add it to).

Adding the first action will add this to the empty cart template:

While adding the second action will then display this throughout the rest of the WooCommerce pages, such as the shop archives and product pages.

Our notice will display while the WooCommerce cart is empty, then disappear once an item has been added to the cart (which is a great time to let Cart Notices take over!).

Like it? Share the love:

Published by Beka Rice

Beka leads product direction for SkyVerge, focusing on new features for our plugins and Jilt. She spends a lot of time on research and interviews, but likes to write so she has an excuse to spend more time jamming out to anything from The Clash to Lady Gaga.

Leave a Reply

Your email address will not be published. Required fields are marked *