“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


wp-cron events stopped working and are showing next run in the past

It sounds like your WordPress cron jobs (wp-cron.php) are not firing correctly, which is a common is...

How to Change the Active Link Color in Navigation Menu Using CSS: The Ultimate Guide

Having proper visual feedback in your website’s navigation is crucial for both user experience...

Fail2Ban plugin on DigitalOcean

Fail2Ban is an excellent security tool for any Linux server, and DigitalOcean Droplets are no except...

WordPress FSE Child Theme Template Loading Issues

A common challenge when working with Full Site Editing (FSE) themes and child themes in WordPress: y...

Recent Posts