Get a fast, conversion-focused WooCommerce theme in 2024. Switch to Shoptimizer.

Home Documentation Shoptimizer Shop and Categories Configuring Ajax Add to Cart

Configuring Ajax Add to Cart

There are three separate options you can have happen when a customer clicks that all important “Add to cart” button.

  1. The product can be added immediately to the cart via ajax, without a page refresh. A sidebar drawer appears and the item is automatically added.
  2. The product can be added with a page refresh. After refreshing, you’ll see a banner or notice which says that the item is now in the cart.
  3. Or finally, you can redirect to the cart page immediately after pressing it.

We’re going to discuss the setup steps to undertake for each option.

You will need to match the exact settings outlined in the instructions below.

1. Add to cart immediately via ajax without a page refresh

We use this approach on the main Shoptimizer theme demo site if you want to see an example of it in action.

WooCommerce Ajax Settings

Go to: WooCommerce > Settings > Products tab and only check the option “Enable AJAX add to cart buttons on archives”.

This will enable ajax on the catalog screens, but with Shoptimizer you can also enable this on the product page itself.

Customizer Single Product Ajax Enabled

To do so, go to: Appearance > Customize > Layout > WooCommerce and switch on: Enable single product ajax

If you have switched on single product ajax, the Enable sidebar cart drawer toggle in the customizer next to it must also be active in order for it to work.

2. Add to cart with a page refresh

If you would prefer a page refresh after adding a product to the cart, you can configure your settings in the following way.

WooCommerce Ajax Settings Switched Off

Go to: WooCommerce > Settings > Products tab and ensure that neither option is ticked.

Customizer Single Product Ajax Disabled

Then go to: Appearance > Customize > Layout > WooCommerce and it’s important to ensure that “Enable single product ajax” is switched off.

3. Redirect to the cart page instead

You may wish to redirect to the cart page as soon as the “Add to cart” button is clicked. If that is what you want you will need to configure Shoptimizer using the following settings.

WooCommerce Ajax Settings - Redirect to Cart

Go to: WooCommerce > Settings > Products tab and only check the option “Redirect to the cart page after successful addition”.

Customizer Single Product Ajax Disabled

Finally go to: Appearance > Customize > Layout > WooCommerce and check that the “Enable single product ajax” option is switched off.

Success!

The discount has been applied. You will see it when you checkout.

There has been a problem

Unfortunately this discount cannot be applied to your cart.

$50
Off

Do you want a whopping $50 off Shoptimizer for WooCommerce?

Click the button below to get Shoptimizer for only $49. (Regular price: $99).
This is a special launch offer for today only.
Get it before it is gone!