2025-09-19 – Shipping Address Badge System Fixes
Critical Bug Fixes
Fixed False Positive “Address Updated” Badges
- Problem: Every order was showing “📍 Address Updated” badge even when no shipping changes occurred
- Root Cause: Both webhook handler and sync process were calling
updateOrderShippingAddress with faulty comparison logic
- Solution: Temporarily disabled automatic shipping address updates in both webhook and sync processes
- Result: Only legitimate address changes now show the badge (e.g., order #5303 from 8/29)
Database Cleanup
- Cleared all false positive
shipping_updated_at timestamps from recent orders
- Restored only the legitimate shipping update for order #5303
- Prevented system from appearing unreliable to staff/customers
Code Changes
src/app/api/webhooks/shopify/route.ts: Disabled updateOrderShippingAddress calls in webhook handler
src/app/api/orders/sync/route.ts: Disabled shipping updates during order sync process
- Database: Reset
shipping_updated_at values to prevent false badge displays
Build & Deployment Fixes
Fixed Multiple Build Errors
- JSX Syntax Error: Fixed missing fragment wrapper in
invoice-dialog.tsx
- Import Path Error: Corrected
useToast import path in invoice-creation-success.tsx
- Linting Errors: Commented out unused variables and fixed unescaped entities
- Route Conflict: Removed duplicate API route causing Next.js build failures
Current Status
Working
- Badge system now shows accurate shipping address change indicators
- Invoice creation flow functional
- Build and deployment process stable
Root cause: updateOrderShippingAddress comparison logic is faulty – treats every address as “changed”
What needs to be done RIGHT NOW:
- Debug the address comparison in
updateOrderShippingAddress function
- Fix the logic so it only flags actual changes
- Re-enable webhook and sync shipping updates
- Test with real address changes to make sure it works
System Reliability
- Address root cause of frequent Friday system failures
- Implement better testing for critical workflows
- Consider staging environment for testing changes