Problem/Motivation
Currently, customers need to select each variation via radio buttons or a select list to check stock availability, which can be time-consuming and inconvenient. This process negatively impacts the user experience as customers cannot quickly see which variations are in stock or out of stock. There is a need for a more efficient way to display variation stock availability directly on the product page without rendering an "Add to Cart" form for each variation.
Proposed Resolution
This enhancement aims to improve the user experience by displaying stock availability for all product variations directly on the product page as it loads. The solution involves:
1. Configurable Out-of-Stock Message:
- Adding a configuration option in the Drupal admin interface to set a customizable out-of-stock text message.
2. Modifying the Add-to-Cart Form:
- Dynamically including the out-of-stock text message in the attribute select options based on the stock status of each variation.
| Comment | File | Size | Author |
|---|
Issue fork commerce_stock-3464147
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
introfini commentedThe merge request (MR) introduces this functionality.
To configure the desired message, follow these steps:
With these settings updated, each product variation will now display an indication if it is out of stock.
Comment #6
umitSomething like this is definitely needed. Otherwise, it will be too troublesome for the end user, and a CSS class should be added for styling in sites that use processed attributes.
+1
Comment #7
umitComment #8
trevorkjorlien commentedNeeding this functionality myself. I ran the branch and can fill out and save the new form field.
But when I load up a product page, the
{{product.variations}}field doesn't appear, which loads the add to cart form. I also get this error: