https://github.com/peterbrain/magento2-salable-qty
Display a custom message about the salable quantity on the product detail page. E.g. Only x items left! Disable the Add to cart button for products without salable quantity.
https://github.com/peterbrain/magento2-salable-qty
magento magento-2 magento-extension magento-module magento2 magento2-extension magento2-extension-free magento2-module
Last synced: 10 months ago
JSON representation
Display a custom message about the salable quantity on the product detail page. E.g. Only x items left! Disable the Add to cart button for products without salable quantity.
- Host: GitHub
- URL: https://github.com/peterbrain/magento2-salable-qty
- Owner: PeterBrain
- License: mit
- Created: 2023-02-22T21:03:40.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-02-03T16:23:33.000Z (over 1 year ago)
- Last Synced: 2025-02-03T17:28:39.216Z (over 1 year ago)
- Topics: magento, magento-2, magento-extension, magento-module, magento2, magento2-extension, magento2-extension-free, magento2-module
- Language: PHP
- Homepage:
- Size: 128 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Magento 2 Module - SalableQty
Package name: `peterbrain/magento2-salable-qty`
- [Magento 2 Module - SalableQty](#magento-2-module---salableqty)
- [Main Functionalities](#main-functionalities)
- [Installation](#installation)
- [Method 1: Composer (recommended)](#method-1-composer-recommended)
- [Method 2: Zip file (not recommended)](#method-2-zip-file-not-recommended)
- [Enable \& deploy](#enable--deploy)
- [Usage](#usage)
## Main Functionalities
- Display a custom message about the salable quantity on the product detail page.
- Customizable message: Only x item(s) left!
- Customizable threshold
- Display custom message for products without salable quantity. This is the case if a product quantity equals 1 and is ordered, but is not yet shipped. The default behavior of Magento 2 is to display an error message that the requested quantity is no longer available after a click on the Add to cart button. Not ideal, because this can cause confusion as the product will continue to be displayed as "in stock" until it is shipped.
- Option to disable the Add to cart button
- Option to show a lock symbol on the Add to Cart button
- Customizable message: This product has been sold recently and is no longer available.
Display custom message for products with salable quantity at or below threshold:

Disable Add to cart button for products without salable quantity:

Admin configuration:

## Installation
### Method 1: Composer (recommended)
```bash
composer require peterbrain/magento2-salable-qty
```
### Method 2: Zip file (not recommended)
- Unzip the zip file in `app/code/PeterBrain`
This extension requires [PeterBrain Core](https://github.com/PeterBrain/magento2-peterbrain-core). Ensure that you have it installed prior to installing this module. Use Composer to install it automatically with this module.
### Enable & deploy
```bash
bin/magento module:enable PeterBrain_SalableQty
bin/magento setup:upgrade
bin/magento setup:static-content:deploy
bin/magento cache:flush
```
## Usage
- Enable module output in `Stores > Configuration > PeterBrain Extensions > Salable Quantity > General Configuration`
- Set a custom message for products with salable quantity is zero
- Disable the add to cart button if salable quantity is zero
- Set a custom minimum salable quantity threshold
- Set a custom message for salable product quantity at or below the custom threshold