“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:

1
2
3
4
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:

1
2
3
4
5
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


Limit total quantity globally for specific product category in WooCommerce

To limit the total quantity globally for a specific product category in WooCommerce, you can use a c...

How to Retain Local Storage When Changing WooCommerce Payment Method?

When users switch payment methods on the WooCommerce checkout page, local storage data may reset, ca...

WordPress Redirect Issues Across Multiple Websites

Experiencing redirect loops or unwanted redirects on multiple WordPress sites? Here’s a guide to d...

How to Retrieve and Expose Gutenberg & Theme-Generated CSS in WordPress

If you want to extract the CSS generated by Gutenberg and your WordPress theme, you can do so using ...