Implement comprehensive stock management integration (v1.1.0)

Added complete inventory tracking system for composable products:
- Stock validation during product selection and add-to-cart
- Automatic stock deduction on order completion/processing
- Automatic stock restoration on order cancellation/refund
- Stock status indicators with visual feedback (In stock, Low stock, Out of stock)
- Prevention of out-of-stock item selection
- Low stock warnings when 5 or fewer items remain
- Order notes documenting all stock changes

New files:
- includes/Stock_Manager.php: Core stock management logic

Modified files:
- includes/Cart_Handler.php: Integrated stock validation
- includes/Product_Selector.php: Added stock info to product data
- includes/Plugin.php: Added Stock_Manager to includes
- templates/product-selector.twig: Stock status display
- assets/css/frontend.css: Stock indicator styling
- languages/*.pot/*.po: 8 new translatable strings

Version bumped to 1.1.0 with updated CHANGELOG.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-31 16:41:53 +01:00
parent a581ef42e6
commit e9df6e4278
11 changed files with 489 additions and 5 deletions

View File

@@ -54,6 +54,20 @@
background: #f0f8ff;
}
.composable-product-item.out-of-stock {
opacity: 0.6;
cursor: not-allowed;
}
.composable-product-item.out-of-stock:hover {
border-color: #e0e0e0;
box-shadow: none;
}
.composable-product-item.out-of-stock .product-item-label {
cursor: not-allowed;
}
.product-item-label {
display: block;
padding: 1rem;
@@ -94,6 +108,33 @@
font-size: 0.9rem;
}
.product-item-stock {
margin-top: 0.5rem;
font-size: 0.85rem;
}
.stock-status {
display: inline-block;
padding: 0.25rem 0.5rem;
border-radius: 3px;
font-weight: 500;
}
.stock-status.in-stock {
color: #2e7d32;
background: #e8f5e9;
}
.stock-status.low-stock {
color: #f57c00;
background: #fff3e0;
}
.stock-status.out-of-stock {
color: #c62828;
background: #ffebee;
}
.product-item-checkmark {
position: absolute;
top: 0.5rem;