Bug #11634
openIssues in e-commerce
100%
Description
1. Weather and Season rules are being displayed on the e-commerce website even when no weather or seasonal promotions have been configured or applied.
2. The Recently Viewed section displays products from other companies. It should display only the products belonging to the currently selected company.
3. The wishlist from the previous company is carrying over to the new company and weather rules are also coming.
4.In the Product Details page, when the stock quantity is increased, the updated stock is not reflected in the Cart.
5.In the Frequently Bought Together section, a product with a 2 kg variant is displayed, but when adding it to the cart, the system adds the 500 g variant instead of the selected 2 kg variant.
6.On the Product Details page, the message “Receive 462 points for buying this item” is displayed, but the reward points are not being credited after purchasing the product.
7.After submitting a reply to a question in Admin → Product Q/A, the reply is not displayed on the corresponding Product Details page. The system should save the admin's reply and display it under the respective question on the Product Details page.
Cart & Checkout
8.In cart and checkout page,The color switch option is not working in the cart. The variant changes, but the color does not change.
9.When the quantity is changed from 500g to 1kg in the Cart, the variant is automatically updated to 1kg on the Product Details page as well.
10.After placing an order, the ordered product still remains in the Cart. The product should be automatically removed from the Cart once the order is successfully placed.
11.In the Cart, the main Delete option is not working.
12.In the Frequently Bought Together section, a 10% discount is displayed with the message “Save $18.20 (10% off),” but the discount is not applied to the cart after adding the selected items.
13.On the checkout page, allow customers to enter a separate recipient name and phone number along with the delivery address when placing an order for someone else, instead of automatically using their existing customer details.
14.Functional Issue: During checkout, only one benefit can be applied at a time—either a coupon or reward points. The system should allow both to be applied together according to the configured rules.
15.Functional Issue: When placing an order, the system displays a 409 error: “Connection operation buffering timed out after 10000ms.”
16.Functional Issue: After a product is delivered, clicking the “Review and Rating” link in the email redirects the customer to the login page (https://test.pos.evergreenfarmsusa.com/login) instead of opening the product review and rating page.
17.Functional Issue: Customers can edit their reviews and ratings even after admin approval, allowing them to change the approved review and post negative feedback without re-approval. Any edits to an approved review should require admin approval before being displayed on the e-commerce website.
18.UI Issue: In View Ledger -> Rewards history, reduce search bar width.
19.When adding a new address, provide fields to enter a separate recipient name and phone number for that address, instead of automatically using the existing customer details.
Subtasks
Related issues
Updated by Ajit A 10 days ago
1. Repository: evergreenpos_E-commerce_new (Storefront Frontend)
Frequently Bought Together Variant Selection:
Connected PDP active variant context (activeVariant, activePrice, originalPrice) into
PdpMerchSections.tsx
.
Updated the "This item" card to dynamically render the selected variant badge (e.g., 2 kg), image, and variant price.
Rewrote handleAddBundleToCart to construct a complete cart line item containing compositeId, variantSku, variantTitle, and variantAttributes, preventing fallback to the default 500 g variant.
Guest Flow Cart Promo Request Flooding:
Gated
useCartPromo.ts
behind isAuthenticated. In without-login (guest) flow, promo rule evaluation is disabled and returns emptyPromo without firing network requests.
Added AbortSignal cancellation in
growthApi.ts
and extended stepper debounce to 750ms to cancel intermediate in-flight requests during stepper clicks.
Updated
cart.tsx
and
QuickCart.tsx
to pass { enabled: Boolean(isAuthenticated) }.
PDP "Add to Cart" Button State:
Fixed
productdetailsui.tsx
where the button remained permanently stuck on "Added" when stock increased. Added a 2.5s timer to show "Added to Cart!" before reverting to "Add to Cart", and reset justAdded when the quantity stepper is clicked.
Recently Viewed Company Isolation:
Scoped recently_viewed storage keys by companyId in
ecomPolishStorage.ts
and filtered items in
RecentlyViewedSection.tsx
.
Wired
authSlice.ts
and
ProfileMenu.tsx
to clear tenant recently viewed items on logout.
Bug Fixes:
Fixed broken relative import path for categoryData.js in
RecentPickedCategories.tsx
.
2. Repository: evergreen_pos_be (Backend API)
Weather Promos & Product Rail Latency:
Fast-pathed database resolution in
weatherProduct.controller.js
using req.tenant.company.dbName and cached tenant company contexts, resolving the ~7000ms latency down to <20ms.
Made Company.updateOne({ lastWeatherAlertRunAt }) non-blocking to eliminate write locks on read queries.
Removed the count < 3 category diversity constraint, raised query limit from 50 to 100, and output limit to 48 so full category products show in the weather picks section.
SaaS Billing & Token Verification Caching:
Cached saasBilling checks in
nursery.token.js
with TTL to prevent DB bottlenecks on every incoming storefront request.
Promo Rules Tenant Resolution:
In
promoRule.controller.js
, added req.tenant?.company?.dbName lookup to avoid redundant Companies.findOne lookups.
Merchandising & Multi-Tenant Data Scoping:
Scoped recently viewed and merchandising items in
merchIntel.service.js
strictly to the tenant's database and company ID.
3. Repository: evergreen_pos_fe (Admin POS Frontend)
Flash Promos Switch & Request Optimization:
Added optimistic toggle states and inline spinners to promo switches in
WeatherSeasonRulesPage.tsx
with error rollbacks.
Used patch response directly to update the promo list without issuing a redundant loadPromos GET request.
Tab Lazy Loading:
Replaced the initial 4 concurrent API calls on mount with per-tab lazy loading (loadedTabsRef) so only the active tab fetches data.
Updated by Ajit A 7 days ago
Overview
Optimized storefront and checkout performance, resolved duplicate API calls, fixed cart item retention after order placement, and improved variant selection accuracy across the e-commerce storefront and backend services.
Repository 1: Backend (evergreen_pos_be)
1. Key Modifications & Features
Checkout API Optimization (/api/v1/comm/checkout): Parallelized independent database lookups (CartService.getCartByIdEcom, ClientModel.findOne, CouponModel.find, and resolveCouponTimezone) using Promise.all. Added a 2-second timeout guard on external tax calculations to avoid checkout delays.
Cart API Optimization (/api/v1/comm/cart): Implemented lazy-loading in getCartByIdEcom. If the cart is empty, it returns immediately without executing redundant queries against ProductModel, OfferModel, or weather services. Added short-lived caching for active offers (60s TTL).
Post-Order Cart Clearing (/api/v1/comm/dlt-all): Replaced multiple sequential remote database calls and iterative updateMany loops with a single consolidated $or query matching both _id and customerId.
Loyalty & Referral Quote Acceleration: Parallelized customer and loyalty wallet lookups, cached active loyalty programs (2 min TTL), and added a cached tenant lookup for referral quotes to eliminate redundant Companies.findOne queries.
Shipping Split Rates Caching & Deduplication: Added in-flight request deduplication for FedEx live rate calculation to eliminate concurrent duplicate rate calls.
Database Indexing: Added explicit compound indexes on cartSchema (customerId: 1, userId: 1) to eliminate collection scans.
2. Bug Fixes
Fixed post-order cart cleanup where ordered items persisted due to mismatched cart identifiers between guest and authenticated sessions.
Corrected reference resolution in clearCustomerEcomCart to prevent unhandled rejections during cart purge.
Fixed award of loyalty points for pickup and direct cash/zelle delivery orders in sale.service.js.
3. File-by-File Summary
File Changes Made
src/controllers/nursery/ecom.controller.js
Removed unindexed admin queries in CartGetById; streamlined CartDltAll into a single bulk update query; added safe fallback in CartNWCount.
src/controllers/nursery/referral.controller.js
Added slugToDbNameCache (5m TTL) to avoid querying Companies on every referral quote.
src/models/nursery/cart.model.js
Added indexes on customerId and userId.
src/routes/nursery/ecom.route.js
Standardized split-rates, PDP, and checkout route definitions.
src/routes/nursery/shop.route.js
Streamlined storefront catalog routing.
src/services/loyaltyEngine.js
Parallelized wallet and customer fetches; added caching for active loyalty programs.
src/services/loyaltyProgram.service.js
Optimized point calculation queries; avoided redundant product lookups when item prices are present in cart.
src/services/nursery/cart.service.js
Implemented early return for empty carts; cached active offers (60s); updated composite variant inventory resolution; fixed clearCustomerEcomCart.
src/services/nursery/ecom.service.js
Parallelized getCheckoutDataEcom queries; cached active coupons (30s) and tax calculations (60s) with timeout fallback; fixed syntax error.
src/services/nursery/order.service.js
Ensured cart cleanup triggers upon order creation.
src/services/nursery/product.service.js
Optimized /api/v1/comm/find search with indexed queries and parallel counts.
src/services/nursery/rbac.service.js
Cleaned error handling and role lookup execution.
src/services/nursery/referral.service.js
Added customerCreditCache (30s TTL) with instant invalidation upon credit application.
src/services/nursery/sale.service.js
Updated processLoyaltyEcomEarning to award loyalty points on pickup and cash/zelle delivered orders.
src/services/shipping/shippingSplit.service.js
Deduplicated in-flight split rate requests; cached rate results.
Repository 2: Frontend (evergreenpos_E-commerce_new)
1. Key Modifications & Features
Checkout Network Optimization: Added debouncing (500ms) and payload memoization (lastReferralPayloadRef) to referral quote calculations, preventing repeated calls on state updates. Added 250ms debounce on address verification during checkout load.
PDP Duplicate API Prevention: Prevented duplicate trust badge, review, and Q&A API calls when navigating between Cart and PDP using fetchedTrustPidRef.
Preorder API Scope Restriction: Suppressed preorder availability background checks on post-purchase pages (/order-success, /orders, /my-account).
Cart Cleanup Reliability: Enhanced clearCustomerCartOnOrderSuccess to optimistically clear local storage, Redux cart state, and backend cart records simultaneously upon order placement.
Variant Selection Stability: Enhanced variant selection logic to default to index 0 when opening PDP while correctly mapping composite IDs (<productId>_<variantSku>) from the cart.
2. Bug Fixes
Fixed missing TrendingDown icon import in
productdetailsui.tsx
.
Fixed issue where products remained in the cart after completing order placement.
Resolved variant selector mismatch in cart items where variant attributes did not sync with the active SKU.
3. File-by-File Summary
File Changes Made
src/api/ecomApiPaths.ts
Centralized and normalized API endpoint paths.
src/components/CartItemVariantSelector.tsx
Fixed active variant detection to accurately reflect SKU changes.
src/context/PreorderAvailabilityContext.tsx
Suppressed preorder polling on order success, account, and confirmation routes.
src/features/cart/page/components/CartItemCard.tsx
Fixed variant attribute rendering and navigation link state.
src/features/cart/page/components/CartProducts.tsx
Updated empty cart state and clear cart triggers.
src/features/checkout/pages/Checkout.tsx
Debounced referral quotes and address checks; stabilized variant modal selection.
src/features/checkout/pages/CheckoutPreorder.tsx
Applied debounce guards to preorder checkout calculations.
src/features/loyalty/components/LoyaltyProfilePanel.tsx
Safe number parsing and currency formatting for reward balance displays.
src/features/loyalty/pages/RewardsPage.tsx
Handled edge cases where point balance or tier info is undefined.
src/features/loyalty/utils.ts
Shared loyalty formatting utilities.
src/features/orders/pages/OrderSuccess.tsx
Ensured comprehensive cart wipe (local storage, Redux, backend) on mount.
src/features/products/pages/productdetailsui.tsx
Fixed TrendingDown icon import; prevented duplicate API requests on navigation; preserved variant selection.
src/hooks/useCart.tsx
Added optimistic state clearing; corrected composite item ID matching.
src/utils/cartCleanup.ts
Implemented unified cart purge utility across storage and remote API.
src/utils/storefrontUtils.ts
Added helper utilities for query formatting and variant identification.
Updated by Ajit A 5 days ago
- Estimated time changed from 26:00 h to 28:00 h
Project Overview & Objectives Addressed
Delivery Destination Recipient Fields & Phone Validation: Enabled customers to specify dedicated recipient contact information (separate from the account owner) when adding or editing delivery addresses in checkout, dynamic country calling code integration via the Company Settings API, and strict 10-digit phone number validation.
Review Re-Moderation Security: Secured review editing so that edits to previously approved reviews require admin re-approval before going live. Added an "Edited" badge in the admin moderation dashboard.
Product Click 404 Resolution: Fixed product navigation from order history by ensuring slug/ID fallbacks resolve properly on the storefront.
UI Refinements: Optimized rewards ledger search bar layout and checkout payment modal interactions.
Repository 1: evergreenpos_E-commerce_new (Storefront Frontend)
Key Modifications & Features
Delivery Destination Recipient Details (
AddressSelectionModal.tsx
):
Added explicit fields for Recipient First Name, Recipient Last Name, and Recipient Phone.
Added a "Use My Account Details" quick-fill button for one-click population of account owner credentials.
Added a country code <select> dropdown beside the phone input dynamically populated from the Company Settings API (settings?.preferredCountries).
Implemented real-time national phone formatting and dynamic input placeholders ((555) 000-0000 vs 98765 43210).
Added strict phone number validation preventing incomplete numbers (e.g., 79809) with inline error banners.
Formats and persists full international phone numbers with country code prefix upon saving or editing addresses.
Checkout Address Synchronization (
Checkout.tsx
&
CheckoutPreorder.tsx
):
Integrated dynamic dialOptions loaded from Company Settings into the checkout "Ordering for someone else" recipient sections.
Updated inline recipient phone validation to use
validatePhoneNumberDigits
.
Updated address creation callback (onAddNewAddress) to accept address override payloads directly from the modal.
Updated
mapPropertyDetailsToAddresses.ts
to parse and map receiverName and receiverPhoneNumber per address.
International Phone Utilities (
phoneIntl.ts
):
Added
KNOWN_COUNTRY_DIAL_MAP
with standard international calling codes.
Added
getCountryDialOptions
to dynamically resolve calling codes from preferredCountries with currency-based fallback (+91 for INR, +1 for USD).
Added
validatePhoneNumberDigits
with strict length validation for +1, +91, and international codes.
Enhanced
parsePhoneNumber
to extract arbitrary international prefixes.
Order History Navigation & Review Flow:
OrderDetails.tsx
&
routes.config.tsx
: Fixed navigation from order items to product details by resolving valid product slugs and fallback IDs to eliminate 404 errors.
ReviewModal.tsx
: Added UI banner notifying customers that editing an approved review requires admin re-approval before it is shown on the website.
UI & Rewards Ledger:
LoyaltyProfilePanel.tsx
: Reduced the search bar width in View Ledger -> Rewards history.
Repository 2: evergreen_pos_fe (POS Admin/Staff Frontend)
Key Modifications & Features
Review Moderation Page (
ReviewModerationPage.tsx
):
Added a distinct "Edited" badge indicator alongside the review status for reviews edited by customers.
Added a tooltip showing the exact timestamp when the customer edited the review (editedAt).
Repository 3: evergreen_pos_be (Backend API & Services)
Key Modifications & Bug Fixes
Customer Review Re-Moderation Logic (
shop-controller.js
&
productReview.model.js
):
Added isEdited: { type: Boolean, default: false } and editedAt: { type: Date } schema fields to product reviews.
Updated review update endpoint: when a customer updates an existing review (even if previously approved), its status automatically reverts to 'pending' and flags isEdited: true, requiring admin re-approval before appearing on storefront.
Enforced storefront review queries to filter only reviews with status: 'approved'.
Address & Recipient Payload Handling (
order.service.js
&
cart.service.js
):
Added persistence for receiverName and receiverPhoneNumber in customer property details and order shipping records.
Product Lookup Fallbacks (
ecom.controller.js
):
Added dual lookup supporting both product slug and _id, preventing 404 responses when clicked from order history.