2025-09-22 – Order Combining Detection System
Order Management Enhancement – Duplicate Order Detection
Problem Identified
- Issue: Multiple pending orders for the same customer are being fulfilled separately
- Impact: Inefficient shipping, increased costs, poor customer experience
- Risk: Continued waste of shipping resources and potential customer dissatisfaction
- Priority: High – addresses operational inefficiency and cost savings opportunity
Investigation Plan
- [ ] Analyze current order structure and customer identification methods
- [ ] Identify how to detect orders that can be combined
- [ ] Evaluate combining orders in Shopify vs. internal system
- [ ] Design UI notifications for combinable orders
- [ ] Implement detection logic for same customer/same address orders
Current Analysis
- Order Structure: Need to examine
mama_tried_ordersand related tables - Customer Matching: Identify how customers are linked across orders
- Address Matching: Determine if shipping addresses can be reliably compared
- Shopify Integration: Evaluate feasibility of combining orders at Shopify level
- Internal System: Assess benefits of internal order combining workflow
Technical Implementation Plan
Order Detection Logic ✅ IMPLEMENTED
- Customer Matching: Use customer_id, email, shipping name, and address for identification
- Status Filtering: Focus on pending orders that haven’t been processed yet
- Address Validation: Implement fuzzy address matching for slight variations
- Time Window: Consider orders placed within a reasonable time frame (e.g., same day)
- API Endpoint:
/api/orders/combinablereturns groups of combinable orders
UI/UX Enhancements ✅ IMPLEMENTED
- Notification System: Alert staff when combinable orders are detected
- Order Details Page: Show potential order combinations
- Batch Processing: Option to combine orders before fulfillment
- Visual Indicators: Clear flags for orders that can be combined
Integration Considerations
- Shopify API: Evaluate if Shopify supports order combining
- Shipping Impact: Ensure combined orders maintain proper shipping calculations
- Inventory Management: Verify stock levels can handle combined quantities
- Workflow Integration: Integrate with existing order processing workflow
Shopify vs Internal Order Combining Evaluation
Shopify Order Combining Limitations
- Shopify API Constraints: Shopify does not provide native order combining functionality
- Order Integrity: Each Shopify order has unique identifiers that cannot be merged
- Customer Experience: Combining at Shopify level would require order cancellation/recreation
- Third-party Dependencies: Would need to handle refunds, notifications, and customer communication
- Timeline Issues: Orders already in fulfillment pipeline cannot be easily combined
Internal System Combining Advantages
- Workflow Control: Full control over the combining process within existing workflows
- Data Integrity: Maintain order history and audit trails for each original order
- Customer Transparency: Keep original order numbers for customer reference
- Flexible Logic: Implement business rules for when/how orders can be combined
- Shipping Optimization: Better control over shipping calculations and methods
Recommended Approach: Internal System with Notifications
- Phase 1 (✅ Completed): Detection and notification system (implemented)
- Phase 2 (Recommended): Internal order combining with virtual consolidation
- Phase 3 (Optional): Shopify fulfillment grouping for shipping efficiency
Internal Combining Strategy
- Virtual Consolidation: Create combined orders in internal system without modifying Shopify
- Batch Processing: Process combined orders together for fulfillment
- Shipping Optimization: Apply combined shipping rates and methods
- Audit Trail: Maintain links between original and combined orders
- Customer Communication: Reference original order numbers in combined shipments
Current Status
Completed
- Analyzed order management system structure
- Created API endpoint for detecting combinable orders (
/api/orders/combinable) - Built UI component for displaying combinable order alerts
- Integrated notification system into orders page
- Implemented customer-based and address-based matching logic
In Progress
- Evaluating technical approaches for order detection and combining
Next Steps
- Test with real order data
- Add order combining functionality (API endpoint to combine orders)
- Enhance UI with combine action buttons
- Evaluate Shopify vs internal combining approach
Notes
- Operational Efficiency: This addresses a real-world inefficiency observed in shipping
- Customer Experience: Combined orders provide better service and potentially faster delivery
- Cost Savings: Reduced shipping costs through order consolidation
- Implementation Strategy: Start with detection and notifications, then evaluate combining options
