“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


Google Tag Manager is Breaking My Oxygen-Built Website (WordPress)

Fix: Google Tag Manager Breaking Oxygen-Built WordPress Website If Google Tag Manager (GTM) is causi...

Step-by-Step Guide to Define HTML Structure in WordPress Menus

WordPress menu customization allows you to create professional, functional navigation systems. This ...

Custom query filter for order by is causing issue with group by in wordpress

If your custom query filter for ORDER BY is causing issues with GROUP BY in WordPress, it’s li...

How to Set Default Attributes for New Blocks Without Affecting Existing Ones

When working with block-based content editors, a common need is to establish default attributes for ...

Recent Posts