“Maximum Available Quantity Has Been Added to Cart” Error in WooCommerce

Seeing the “Maximum available quantity has been added to cart” error in WooCommerce? This happens when a product’s stock limits prevent additional items from being added. Here’s how to fix it.

Why Does This Error Happen?

  • Stock settings are restricting the available quantity.
  • WooCommerce session cache is not updating properly.
  • Custom code or plugins are interfering with cart functionality.

Solutions to Fix the Issue

1. Check WooCommerce Stock Settings

Ensure the product has sufficient stock:

  • Go to Products > Edit Product.
  • Scroll to Inventory settings.
  • Make sure Stock quantity is set correctly.
  • Uncheck “Sold Individually” if you want to allow multiple purchases.

2. Clear WooCommerce and Browser Cache

Cached data may cause quantity issues. Clear cache:

  • Go to WooCommerce > Status > Tools.
  • Click “Clear transients” and “Clear customer sessions”.
  • Clear your browser cache or test in incognito mode.

3. Allow Higher Quantities in WooCommerce

If WooCommerce enforces a limit, override it using this custom code:

function custom_wc_max_quantity($max, $product) {
    return 100; // Set maximum limit as needed
}
add_filter('woocommerce_quantity_input_max', 'custom_wc_max_quantity', 10, 2);

4. Disable Plugins Causing Conflicts

Some plugins, such as stock management or cart limiters, may interfere.

  • Disable plugins one by one to identify conflicts.
  • Check WooCommerce > Status > Logs for error messages.

5. Refresh WooCommerce Cart Session

To force WooCommerce to update cart quantity correctly, add this code:

function refresh_cart_session() {
    WC()->cart->calculate_totals();
    WC()->cart->set_session();
}
add_action('wp_loaded', 'refresh_cart_session');

6. Check Theme Compatibility

If you’re using a custom theme, it might be overriding WooCommerce settings.

  • Switch to a default theme like Storefront or Twenty Twenty-Four.
  • Test if the issue persists.

Final Checks

  • ✔ Confirm stock settings are correct.
  • ✔ Clear cache and WooCommerce transients.
  • ✔ Disable interfering plugins.
  • ✔ Use custom code to override limits if needed.

If you’ve tried all these fixes and still have the error, let us know your setup! 🚀

Related Posts


How to detect YouTube iframe tag in a specific WordPress post

Detecting YouTube Iframes in WordPress Posts This document outlines two primary methods for detectin...

Why xmlrpc.php Pingbacks Aren’t Working (And How to Fix It)

XML-RPC pingbacks in WordPress can be frustrating when they don’t work as expected. This guide...

Rename Admin Posts Menu items WordPress Without Plugin

You can rename admin menu items. 100% working solutions function change_post_menu_label() { global $...

WordPress Force HTTPS Without Plugin: The Ultimate Method

Hey there! Are you running a WordPress website on WP Engine and want to make it more secure? Worried...

Recent Posts