Maximum Quantity for WooCommerce Shops

外掛說明

Maximum Quantity for WooCommerce Shops is a simple extension for WooCommerce that only does one thing: it lets you set a maximum limit for the number of items that can be added to the cart, for each product, per order.

It’s like one of those signs at the grocery store that says, “LIMIT 2 PER CUSTOMER!”. This plugin will not add a sign like that, but the quantity input field will hit a limit.

You can set a global limit to affect all products in your WooCommerce store or, if you prefer, a different limit for each product, individually. Each product’s own limit will always override the global limit.

This works for all products in your WooCommerce store: Simple and Variable products.

Customers do not have to be logged in for this to work. This works for guest buyers, as well as logged-in buyers.

This plugin was initially developed by Isabel Castillo and later adopted by Marco Almeida | Webdados / PT Woo Plugins.

Header photo by Mick Haupt.

Other (premium) plugins

Already know our other WooCommerce (premium) plugins?

螢幕擷圖

  • The global setting: It is labeled “Maximum quantity per product” and is found at WooCommerce, Settings, Products tab, Inventory link.

  • The individual product’s setting: It is labeled “Max quantity per order” and is found on the individual product edit screen, in the Product Data box, on the Inventory tab.

安裝方式

Install and Activate

  1. In your WordPress dashboard, go to Plugins, Add New.
  2. Search for “Maximum Quantity for WooCommerce Shops” to find the plugin.
  3. When you see “Maximum Quantity for WooCommerce Shops”, click “Install Now” to install the plugin.
  4. Click “Activate” to activate the plugin.

Configuration

The plugin only has 2 settings. You can use these settings in a variety of ways to accomplish the unique goals of your store. See the documentation for specific ways to use these settings:

  1. To set a global limit to affect all products, go to WooCommerce, Settings, Products tab. Click “Inventory”. Scroll down to “Maximum quantity per product”. Set your desired limit there.
  2. To set an individual product limit for a single product, go the product’s own “Edit product” page. Scroll down to the “Product Data” box. Click on the Inventory tab. There, you’ll see the setting called “Max quantity per order” where you can set your desired maximum limit for that product.

常見問題集

Does this plugin work with products with variations (Variable products)?

Yes, since version 1.4.

Can I set a different limit for different products?

Yes, since version 1.4.

Is this plugin compatible with the new WooCommerce High-Performance Order Storage?

Yes, since version 2.0.

Is this plugin compatible with the new WooCommerce block-based Cart and Checkout?

Yes, since version 2.0.

I need help, can I get technical support?

This is a free plugin. It’s our way of giving back to the wonderful WordPress community.

There’s a support tab on the top of this page, where you can ask the community for help. We’ll try to keep an eye on the forums but we cannot promise to answer support tickets.

If you reach us by email or any other direct contact means, we’ll assume you need, premium, and of course, paid-for support.

Where do I report security vulnerabilities found in this plugin?

You can report any security bugs found in the source code of this plugin through the Patchstack Vulnerability Disclosure Program. The Patchstack team will assist you with verification, CVE assignment and take care of notifying the developers of this plugin.

Can I contribute with a translation?

Sure. Go to GlotPress and help us out.

使用者評論

2024 年 7 月 10 日 1 則留言
For 6 years this plugin limited clients to two units of my sample size product to prevent a loss leader from turning into a plain old loss. Just updated it today and several hours later someone ordered 12 units. Had to cancel the order, which means they probably won’t be back because they’ll be offended. I knew I should have left it alone…
2020 年 10 月 8 日
Thanks for this plugin. We use it along with WP Job Manager and WooCommerce Subscriptions. It ensures that our users can only purchase one subscription plan. Before, we faced the issue that a few users accidentally purchased a plan twice. Thanks for investing your time. 🙂 Florian
閱讀全部 36 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈Maximum Quantity for WooCommerce Shops〉的開發相關工作。

參與者

〈Maximum Quantity for WooCommerce Shops〉外掛目前已有 7 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

將〈Maximum Quantity for WooCommerce Shops〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

2.2.1 – 2024-10-08

  • [FIX] Load text domain at the right time to avoid PHP notices on WordPress 6.7 and above
  • [DEV] Tested with WordPress 6.7-beta1-59184 and WooCommerce 9.4.0-beta.2

2.1 – 2024-06-30

  • [NEW] Rename plugin to a more understandable title
  • [TWEAK] Main plugin file header adjustments
  • [TWEAK] Remove .pot file from repository
  • [TWEAK] readme.txt adjustments

2.0 – 2024-06-27

  • Plugin adopted by Marco Almeida | Webdados
  • Rename plugin main file and textdomain to the same as the folder name to follow the plugin development guidelines (the plugin will deactivate on update, and should be manually activated again)
  • Code refactor – Use namespacing, apply coding standards, better logic
  • Use WooCommerce CRUD functions instead of get_post_meta and update_post_meta
  • Fix maximum quantity on the WooCommerce block-based Cart
  • Test and declare WooCommerce High-Performance Order Storage compatibility
  • Test and declare WooCommerce block-based Cart and Checkout compatibility
  • Requires WooCommerce 5.0 and WordPress 5.6
  • Tested with WooCommerce 8.9.0 and WordPress 6.6-alpha-58011

1.6

  • Fixed – Can no longer use WC’s name in plugin.

1.5.2

  • Fixed – Fixed a bug that was ignoring the max on some Variable Products.

1.5.1

  • Fixed – Honor the “Sold individually” setting above the universal max limit.

1.5

  • New – Added filters to the error message strings.
  • Fixed – The max was not being enforced the input field for Variable products.
  • Fixed – The max now works even when backorders are enabled.

1.4.3

  • Fixed – The max limit also works on Variable Products, as long as backorders are not enabled.

1.4.2

  • Fixed a fatal error regarding get_parent_data().

1.4.1

  • New – For variable products, the stock quantity display has been restored. Previously, the stock quantity was hidden for products with variations. This only affected those who were displaying the stock quantity on the product page.
  • Fixed several PHP notices. Thanks to @brettmhoffman.
  • Internationalization – load_plugin_textdomain is now loaded on init rather than plugins_loaded, as it should be.

1.4

  • New – Support for different limits for individual products. See the version 1.4 release post for details.
  • New – Support for Variable products (products with variations). Now, the plugin works with all products, Simple and Variable.
  • Code refactoring – Many functions were renamed:
    isa_get_qty_alread_in_cart was changed to isa_wc_max_qty_get_cart_qty
    isa_max_item_quantity_validation was changed to isa_wc_max_qty_add_to_cart_validation
    add_isa_max_quantity_options was changed to isa_wc_max_qty_options
    isa_woo_max_qty_load_textdomain was changed to isa_wc_max_qty_load_textdomain
    isa_woo_max_qty_update_cart_validation was changed to isa_wc_max_qty_update_cart_validation
    isa_woocommerce_quantity_input_args was changed to isa_wc_max_qty_input_args
  • Code refactoring – One function was removed: isa_woocommerce_available_variation, which was hooked to woocommerce_available_variation, was removed.

1.3

  • New – Added compatibility with the WooCommerce Direct Checkout plugin

1.2.4

  • Fix – The setting had disappeared on last WC update.

1.2.3

  • New – Added Dutch translation, thanks to Martijn Heesters.

1.2.2

  • New – Added German translation, thanks @tofuSCHNITZEL.

1.2.1

  • Fix – Did not calculate quantity properly if you UPDATE Quantity on Cart page. This did not let some users DECREASE or INCREASE the quantity while on the cart page.
  • Maintenance – Tested and passed for WordPress 4.0 compatibility.

1.2.0

  • New – Added .pot translation file.
  • New – Added translations for French, Hindi, and Spanish languages.
  • New – Changed textdomain to plugin slug.
  • Maintenance – Tested and passed for WP 3.9 compatibility.

1.1.9

  • Fix: added _update_cart_validation to avoid manual override on cart update at checkout.
  • Tweak: remove passed=true in validation checks, use the passed parameter instead.
  • Maintenance: replace woocommerce – add_error with wc_add_notice.

1.1.8

  • Fix: now checks for manually-typed quantity because maximum limit was able to be overridden by typing in a number.
  • Fix: a problem in which limit was ignored if product was previously added to cart, then added another item to cart, then re-added this item to cart.
  • Maintenance: Updated description to reflect that this plugin does not yet support products with variations.

1.1.6

  • Fix: maximum limit was able to be overridden by adding a new instance of the item to cart.
  • Fix: maximum limit was able to be overridden by updating quantity on cart page.

1.1.5

  • Tested for WP 3.8 compatibility.

1.1.4

  • Tested for WP 3.7.1 compatibility.

1.1.3

  • bug fix related to syncing with Git.

1.1.2

  • bug fix related to syncing with Git.

1.1.1

  • bugfix related to syncing with Git.

1.1

  • Tested for WP 3.6.1 compatibility

1.0

  • Initial release.