Bug #11507
openBug #11462: Issues in products with variants in admin panel as well as e-commerce
E-commerce Issues: Variant Management, Product Images, Inactive Product Filtering, Cart Status, My Orders Page Loading, and Order Placement Failure
Description
1. New variant options should be added to the existing variant instead of creating a new variant. For example, if 2 KG needs to be added, it should be added to the existing Pack Size variant along with the current options.
2. In cards, Product images should change according to the selected variant like Product Details page. If a variant does not have its own image, it has to show the primary uploaded main images instead of showing the previous variant image.
3. Inactive products should not appear in Recently Viewed. Also, if a subcategory contains only one product and that product is inactive, the subcategory name should not appear in the filters.
4. When the 1 KG variant is already added to the cart, the other variants (250 GM and 500 GM) should display “Add to Cart” instead of showing “Added.”
5. The My Orders page is not loading and displays a “Page Could Not Load” error due to a missing ReturnDestinationWarehouse export in trustApi.ts.
6. While placing an order, the request fails with a 500 Internal Server Error because the backend cannot find the cancellationPolicySnapshot module, resulting in the order not being placed.
Subtasks
Related issues
Updated by Ajit A 6 days ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
- Estimated time changed from 6:00 h to 8:00 h
1. Backend Repository (evergreen_pos_be)
Bug Fixes:
Order Placement 500 Error Resolution: Fixed unhandled error in Mongoose orderSchema.pre('validate') when resolving
cancellationPolicySnapshot
. Added guarded module loading, graceful fallback snapshotting, and safe model resolution across tenant DB connections.
Snapshot Query Sanitization: Hardened
cancellationPolicySnapshot.js
to filter invalid ID values (undefined, null), verify Product.find availability, and fall back per-line to default policies on error.
Key Modifications & Enhancements:
Recently Viewed Inactive Filter: Updated
merchIntel.service.js
(trackRecentlyViewed and getRecentlyViewed) to validate product status (active: true, isDeleted: false, showInEcomm: true), ensuring inactive products are not recorded or returned.
Catalog Subcategory Pruning: Enhanced
product.service.js
(getAllSubByCatIdEcom) to prune subcategories that contain no active, non-deleted e-commerce products.
2. E-Commerce Storefront (evergreenpos_E-commerce_new)
Bug Fixes:
My Orders Page Crash ("Page Could Not Load"): Exported frozen runtime companion objects for ReturnDestinationWarehouse and ReturnDestinationsResponse in
trustApi.ts
to resolve bundler missing export runtime errors.
Route Alias Fix: Added /my-orders/* route alias in
routes.config.tsx
alongside /my-order/* to prevent 404s.
Defensive Client Parsing: Protected
OrderSection.tsx
with safe try...catch JSON parsing for client details.
Key Modifications & Features:
Variant-Scoped Cart Status: Refactored isInCart and inCartQuantity in
productdetailsui.tsx
,
UnifiedCard.tsx
,
ProductUnifiedCard.tsx
, and
ProductDetailsModal.tsx
to match by variant SKU, composite ID, packaging option, and variant attributes.
Dynamic Variant Card Image Switching: Updated product cards to swap the displayed image dynamically upon selecting/hovering variant swatches (color, size), falling back to product main images.
Inactive Product Filtering: Guarded
useCart.tsx
,
ecomPolishStorage.ts
, and
RecentlyViewedSection.tsx
from tracking or displaying inactive/deleted products, with auto-pruning of stale IDs against the live catalog.
Subcategory Filter Count Hardening: In
FilteredProducts.tsx
, suppressed empty subcategories and ensured accurate product count badges.
3. POS Frontend (evergreen_pos_fe)
Key Modifications & Features:
Dimension Merging & Auto-Append in Inventory Management: Enhanced
CreateProduct.tsx
to detect existing variant dimensions when editing or adding product variants.
Duplicate Prevention & UI Guidance: Added real-time merge feedback banners, existing option badges, and customized bulk-add input placeholders to append options to existing dimensions without creating duplicate attributes or affecting existing SKU data.