Inventory & Stock Management
Relevant source files
The following files were used as context for generating this wiki page:
Inventory & Stock Management refers to the system within PrestaShop that tracks, displays, and modifies product quantities. The system operates primarily through the Back Office (BO) under the Catalog > Stocks menu, where merchants manage both physical and available stock levels to ensure product availability for customers.
Sources: README.md:14-20, tests/UI/campaigns/functional/BO/03_catalog/08_stocks/06_displayProductsBelowLowStock.ts:46-50
Core Components and UI Operations
The stock management interface allows users to perform CRUD-like operations on product quantities and view inventory status in real-time.
Stock Tracking Metrics
The system distinguishes between two primary types of quantity metrics:
- Physical Quantity: The total number of units physically present in the warehouse.
- Available Quantity: The number of units available for sale, which may differ from physical stock due to reserved items or pending orders.
Sources: tests/UI/campaigns/functional/BO/03_catalog/08_stocks/06_displayProductsBelowLowStock.ts:60-61, tests/UI/campaigns/functional/BO/03_catalog/08_stocks/06_displayProductsBelowLowStock.ts:88-96
Inventory Updates
Users update stock levels directly within the stock table. The interface provides input fields to adjust quantities. When a quantity update occurs, the system validates the change and displays a success notification.
Sources: tests/UI/campaigns/functional/BO/03_catalog/08_stocks/06_displayProductsBelowLowStock.ts:66-72
The diagram above shows the process for updating stock quantities through the Back Office interface.
Sources: tests/UI/campaigns/functional/BO/03_catalog/08_stocks/06_displayProductsBelowLowStock.ts:68-72
Low Stock Management
PrestaShop includes specialized logic for identifying and prioritizing products with low inventory levels. This facilitates proactive restocking by merchants.
Low Stock Indicators
The system provides a specific setting to "Display products below low stock level first." When this setting is active:
- Products with stock levels below a defined threshold move to the top of the list.
- The product row is visually highlighted (red) to indicate critical stock levels.
- The "Available" column displays a warning indicator (e.g., "0 !").
Sources: tests/UI/campaigns/functional/BO/03_catalog/08_stocks/06_displayProductsBelowLowStock.ts:74-85, tests/UI/campaigns/functional/BO/03_catalog/08_stocks/06_displayProductsBelowLowStock.ts:102-106
Stock Table Fields
The stock management table utilizes the following data columns for inventory tracking:
| Field | Description |
|---|---|
product_id | Unique identifier for the product or combination |
product_name | The descriptive name of the product |
physical | Total count of units on hand |
available | Units remaining for purchase after reservations |
is_low_stock | Boolean flag indicating if stock is below threshold |
Sources: tests/UI/campaigns/functional/BO/03_catalog/08_stocks/06_displayProductsBelowLowStock.ts:81-96, tests/UI/campaigns/functional/BO/03_catalog/08_stocks/06_displayProductsBelowLowStock.ts:114-118
System Integration and Testing
Inventory operations are integrated with the core PrestaShop architecture and are subjected to automated functional testing.
Automated Testing Logic
Functional tests for stock management use Playwright to simulate user interactions. These tests verify the sorting logic and the accuracy of quantity updates.
Sources: tests/UI/package.json:67, tests/UI/campaigns/functional/BO/03_catalog/08_stocks/06_displayProductsBelowLowStock.ts:1-20
The sequence diagram illustrates the interaction between the Merchant, the Back Office interface, and the underlying database during stock monitoring and updates.
Sources: tests/UI/campaigns/functional/BO/03_catalog/08_stocks/06_displayProductsBelowLowStock.ts:40-106
Technical Requirements
The inventory system relies on the core environment specifications of PrestaShop:
- PHP Version: 8.1 or higher.
- Database: MySQL 5.6+, MariaDB, or Percona Server.
- Web Server: Apache or Nginx.
Sources: README.md:38-42, INSTALL.txt:22-25
PrestaShop's inventory management ensures merchants maintain accurate records of product availability, providing visual alerts for low stock to prevent lost sales due to stockouts.
Sources: tests/UI/campaigns/functional/BO/03_catalog/08_stocks/06_displayProductsBelowLowStock.ts:102-106