Project

General

Profile

Edit Copy Actions

Bug #11718

open

Ecom issues

Added by Ajit A 7 days ago. Updated 3 days ago.

Status:
Resolved
Priority:
Normal
Assignee:
Start date:
10/28/2026
Due date:
10/30/2026 (3 days late)
% Done:

100%

Estimated time:
16:00 h
Spent time:
Tested Date:
10/26/2026
Raised by Tester:
Page/ Module (POS):
E commerce

Description

1. When multiple products are added to the cart, one of the products is automatically removed from the cart without user action(sometimes).
2. Applying a coupon does not apply the reward, and applying a reward does not apply the coupon correctly.
3. On the Order Details page, the main order tracking status should reflect the status of the relevant product and display its product name, instead of showing a generic order status when multiple products have different delivery statuses.
4. The cart icon and cart page are responding slowly when the product quantity is increased rapidly on the product listing page. The cart should update promptly and reflect the latest quantity without delay.
5. In the Frequently Bought Together section, display the product variant or pack size (e.g., 500gm) for all recommended products, similar to the main product, so customers can easily identify the selected quantity before adding items to the cart.(Suggestion)
6. The prices displayed in the Frequently Bought Together section do not match the prices shown in the cart after adding the items.
7. Recently Viewed products from other users are displayed in the currently logged-in user's account instead of showing only that user's recently viewed products.
8. The Recently Viewed section displays products from other companies. It should display only the products belonging to the currently selected company.
9. In the E-commerce product page, when selecting the particular color variant, it is not highlighted as the selected color. The selected color should be highlighted correctly in cart and checkout page.
10. 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.(still it is showing Add to Cart in product details page).
11. When the product quantity is increased in the cart, the updated quantity is not reflected on the Product Details page.
12. In the Product Details page, the button continues to display “Add to Cart” even after the product has been added to the cart. It should update to reflect the product’s current cart status.
13. 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.
14. The selected variant highlight configured on the Create Product page is not displayed on the Product Details page.
15. The footer is not fully visible on the Product Details page, as it is partially overlapped by the sticky Add to Cart section at the bottom of the page.
16. On the Product Details page, the Frequently Bought Together section displays the bundle total as $46.84 with a 15% discount. However, in the cart, the 15% bundle discount is applied to each product individually, resulting in discounted prices of $18.70, $12.58, and $11.56, with a total payable amount of $42.84. The bundle total and discount calculation differ between the Product Details page and the cart.
17. When a customer places an order for a friend by entering their friend's name and delivery address, the Admin Order Details page displays the logged-in customer's name instead of the recipient's name. The recipient's name and address should be displayed correctly in the Admin Panel so the order can be delivered to the intended recipient.


Add

Subtasks


Add

Related issues

Actions #1

Updated by Bindu Danda 7 days ago

  • Description updated (diff)
Actions #2

Updated by Anonymous 6 days ago

  • Description updated (diff)
Actions #3

Updated by Ajit A 5 days ago

  • Status changed from New to In Progress
Actions #4

Updated by Ajit A 5 days ago

  • Estimated time set to 16:00 h
Actions #5

Updated by Ajit A 5 days ago

  • Start date changed from 10/26/2026 to 10/28/2026
Actions #6

Updated by Bindu Danda 5 days ago

  • Description updated (diff)

Updated by Ajit A 4 days ago

  • % Done changed from 0 to 50

1. Safety & Regressions Analysis
Flow Verifications:
Checkout & Payment Redirection (Regular & Preorder):
Verified: Currency fallback resolution handles both string codes and full currency objects ({ code: "INR", ... }), eliminating the fallbackCurrency?.toUpperCase is not a function runtime crash.
Verified: Return URLs for Stripe Checkout now systematically retain both slug (tenant) and storeSlug (physical/e-commerce branch location), ensuring customers land back on the exact originating store after card payments or cancellations.
Cart & Variant Management:
Verified: Cart items support composite IDs (${productId}_${variantSku}) alongside legacy plain IDs (${productId}). Matching helpers (matchesCartItem, itemMatchesId) prevent duplicate cart lines when selecting different variants.
Verified: Optimistic quantity and removal updates trigger immediate React state + Redux slice updates with zero UI freeze. Background sync (getCart()) is deferred until all in-flight requests finish, preventing server responses from overriding active customer adjustments.
Routing & Multi-Store Slug Persistence:
Verified: tenantRouting.ts now preserves URL queries (?search, ?storeSlug) and fragments (#hash) when navigating through toTenantPath(). Direct deep-links to specific store locations properly initialize selected_ecom_store_slug in localStorage.
Database & Trust Services (Backend):
Verified: trust.service.js, merchIntel.controller.js, and growth.controller.js now handle transient MongoDB socket disconnections gracefully by re-establishing cached connections (dropCachedConnection) instead of bubbling uncaught 500 errors to the storefront.
Potential Side Effects & Edge Cases to Monitor:
Network Interruptions during Stripe Calls:
Edge Case: When client/host network drops during checkout (e.g. read ECONNRESET), Stripe Checkout creation fails with a 500 status. Soft reservations on MongoDB will remain until TTL expires or reservation release triggers.
Concurrent Variant Additions:
Edge Case: When rapidly adding multiple different variants of the same product within milliseconds, ensure Redux state updates finish sequential dispatch to avoid out-of-order race conditions. Targeted rollback logic has been implemented to roll back only the specific failed line item without wiping sibling items.
URL Query vs Path Slug Precedence:
Edge Case: If a user visits /store-a/home?storeSlug=store-b, URL query parameter takes priority and normalizes the stored session to store-b.

Updated by Ajit A 4 days ago

Bug/Feature/Issue: Route crash on Checkout page with TypeError: fallbackCurrency?.toUpperCase is not a function. Fix: Updated getCountryDialOptions in phoneIntl.ts to accept either string or object formats for fallbackCurrency (fallbackCurrency?: string | { code?: string } | null) and extract the currency code safely via (typeof fallbackCurrency === 'string' ? fallbackCurrency : fallbackCurrency?.code || '').toUpperCase(). Updated call sites in Checkout.tsx, CheckoutPreorder.tsx, and AddressSelectionModal.tsx to pass currency?.code || currency.

Bug/Feature/Issue: Infinite re-render loop on Dashboard and QuickCart with Warning: Maximum update depth exceeded in RecentlyViewedSection.tsx. Fix: Removed inline default empty array assignment (dbItems = []) in useQuery destructuring which created fresh object references on every render. Added isSuccess checks so DB sync only runs after query resolution, and guarded state updates with setItems((prev) => (prev.length === 0 ? prev : [])) to eliminate redundant re-render loops.

Bug/Feature/Issue: Stripe return and cancellation URLs dropped storeSlug on multi-store tenant storefronts. Fix: Updated backend payment.service.js (handleStripeCheckout and handleStripeCheckoutForOrder) to extract storeSlug from request headers, queries, and order metadata, and construct return and cancel URLs using buildStripeReturnUrl with explicit slug and storeSlug preservation.

Bug/Feature/Issue: Transient MongoDB connection drops causing 500 errors on PDP Reviews, Q&A, and Merch Intel endpoints. Fix: Implemented isTransientMongoError checks and automatic connection cache clearing (dropCachedConnection) in trust.service.js, trust.controller.js, merchIntel.controller.js, and growth.controller.js to automatically retry queries against fresh connections and fallback gracefully to empty lists rather than crashing PDP sections.

Bug/Feature/Issue: Cart variant line item collisions and UI lag during quantity updates. Fix: Refactored cartApiSlice.ts, useCart.tsx, and cart.tsx with composite variant ID resolution (${productId}_${variantSku}), helper matchers (itemMatchesId, matchesCartItem), and state-first optimistic updates (optimisticUpdateQuantity, optimisticRemoveProduct). Deferred server re-synchronization until in-flight add operations complete with targeted item-level rollback on failure.

Bug/Feature/Issue: Color swatches in cart variant selector lacked selected indicator and color badge visibility. Fix: Updated CartItemVariantSelector.tsx and ColorSwatchPicker.tsx to display active color badges with preview dot indicators, checkmark icons for selected states, and fallback color extraction across single-variant and multi-variant products.

Bug/Feature/Issue: Order details delivery tracking strip and action button responsive styling issues on mobile devices. Fix: Enhanced DeliveryTrackingStrip.tsx and OrderDetails.tsx with carrier tracking numbers, item-level shipment badges, and updated mobile action buttons (whitespace-nowrap, cursor-pointer, and active scale micro-interactions).

Bug/Feature/Issue: Deep links and tenant navigation paths stripped URL queries and hash fragments. Fix: Updated toTenantPath in tenantRouting.ts to separate query parameters and hashes before normalization and re-append them (${deduplicateStoreSegments(path)}${searchAndHash}), and automatically capture URL storeSlug into localStorage.

Updated by Ajit A 4 days ago

Issue 1: Redundant dlt-all API Triggered on Checkout and Order Success
Bug: Clicking the checkout button or redirecting from Stripe payment to the order details page triggered redundant PUT /v1/comm/dlt-all network calls even though the backend already clears the database cart upon order placement.
Fix: Updated

clearAllCartStateAfterOrder
to default skipServerApi: true, and explicitly passed { silent: true, skipServerApi: true } in

Checkout.tsx
,

CheckoutPreorder.tsx
, and

OrderSuccess.tsx
. Added a 5-second deduplication threshold on the server clear operation.

Issue 2: Redundant GET /cart Refetches on Cart Clear
Bug: Dispatching cartUpdated during post-order cleanup caused

useCart.tsx
to issue multiple GET /v1/comm/cart?_t=... API requests against an already empty cart.
Fix: Replaced cartUpdated events with a dedicated cartCleared event in

cartCleanup.ts
. Added a cartCleared listener in

useCart.tsx
to reset in-memory cart states (cartItems = [], cartCount = 0, subtotal = 0, total = 0) and clear guest storage keys purely client-side without network requests.

Issue 3: Unnecessary Catalog API Requests on Order Redirection
Bug: Navigating from Stripe through OrderSuccess to the order details page caused multiple background catalog API requests (get-allFamily-product, catalogEcom, published) due to broad cache invalidations.
Fix: Removed queryClient.invalidateQueries calls for category-products, trending-products, offers, top-categories-filter, and cross-sell-products in

OrderSuccess.tsx
, restricting network activity strictly to order detail verification.

Issue 4: Ordered Products Remaining in Cart Backend Database
Bug: After placing an order, certain cart documents remained populated in the database if the customer had multiple cart IDs (eCartId vs. cartId) or if the order was completed via Stripe webhook.
Fix: Refactored

clearCustomerEcomCart
in the backend to accept cartId alongside customerId. Added multi-identifier cart deletion targeting specific cart IDs, customer IDs, and user IDs using both Mongoose and native MongoDB driver updates across

shop-controller.js
,

payment.service.js
, and

nursery.product.js
.

Issue 5: Product Details Button and Cart Count Synchronization
Bug: On the Product Details page, button text was not synchronized with the cart status, and changing product variants retained outdated quantities.
Fix: In

productdetailsui.tsx
, standardized button label to "Add to Cart" / "Add to Shop Cart", showing existing cart count in the badge below. Added an effect to reset product quantity to 1 when changing variants or packaging options, and integrated intersection observers for lazy loading reviews and Q&A.

Issue 6: Cart Variant Replacement Duplicating or Desyncing Cart Lines
Bug: Changing an item's variant within the cart drawer triggered concurrent remove and add calls, which occasionally produced duplicate items or failed with stale quantity errors.
Fix: Implemented atomic replaceProductId handling in

cart.service.js
and

useCart.tsx
so variant adjustments update the line item in-place without race conditions.

Issue 7: Preserving User Cart on Logout & Route Fixes
Bug: Logging out of a customer account invoked clearCartApi(), destroying the user's saved shopping cart on the server. Additionally, legacy product detail route patterns had redundant entries.
Fix: Removed clearCartApi() from

UserProfile.tsx
and

ProfileMenu.tsx
to preserve customer carts on the server while resetting local state. Cleaned up legacy routes in

routes.config.tsx
and

LegacyRouteRedirect.tsx
.

Actions #10

Updated by Ajit A 4 days ago

  • % Done changed from 50 to 80
Actions #11

Updated by Ajit A 3 days ago

  • Status changed from In Progress to Resolved
  • % Done changed from 80 to 100
Actions #12

Updated by Ajit A 3 days ago

  • Target version set to sprint (10/12/2026 - 10/31/2026)

Updated by Ajit A 3 days ago

Bug: In the POS Admin Order Details view, orders placed as gifts or for friends showed purchaser details instead of clear recipient delivery contact info. Fix: Updated

AdminOrder.tsx
and

AdminOrderView.tsx
to detect isOrderingForFriend, render a prominent recipient details card (name, phone number with one-click clipboard copy), and route the correct effective recipient delivery address to the shipping section and Google Maps link.

Bug: On the Product Details Page (PDP), the "Frequently Bought Together" bundle total differed from the cart total because PDP calculated the discount on the aggregate sum, whereas the Cart calculated discounts per item before summing. Fix: Refactored the discount calculation in

product.service.js
and

PdpMerchSections.tsx
using calcItemBundleDiscount / calcItemBundlePrice (Math.round(price * (pct / 100) * 100) / 100), ensuring exact 2-decimal rounded parity between PDP bundle pricing and cart itemized deductions.

Updated by Ajit A 3 days ago

  • Due date set to 10/30/2026

1. Safety & Regressions Review
Verification of Existing Flows
Cart & PDP Pricing Parity:
The bundle calculation in

PdpMerchSections.tsx
and

product.service.js
now computes per-item rounded discounts identically to cart.service.js (Math.round(price * discountPct / 100)). No discrepancies between PDP and checkout cart.
Home Page API Consolidation:

getHomeMerchandising
uses Promise.allSettled to isolate failures. If one service (e.g., weather API) fails or times out, the remaining merchandising blocks (seasonal products, promos, store context) still load smoothly.
Individual endpoints (/weather-products, /seasonal-products, etc.) were left intact for backward compatibility on non-home pages.
Location Permission Gating:
Merchandising widgets gracefully display fallback states or remain inert until location is allowed, avoiding unnecessary server load and 3rd-party weather API credit consumption.
Notification Bell Deduplication:

OrderNotificationBell.tsx
deduplicates simultaneous queries via a module-level in-flight promise and a 10-second memory cache. It invalidates cleanly on clearNotes().
Admin Order View (Friend Orders):
Safe fallbacks (recipientName || 'Recipient', address property chaining) ensure normal orders without recipient metadata display their standard customer information without layout breakage.
Potential Side Effects, Edge Cases & Mitigations
Fallback when Location Permission is Denied:
Risk: If a user permanently blocks browser location, isLocationAllowed will remain false.
Status/Mitigation: Weather/seasonal widgets on the home page will not render or call weather APIs, preventing inaccurate geolocation fallbacks. If the user later enters their pincode or city manually via the location selector, isLocationAllowed switches to true and the consolidated API triggers immediately.
Promotion / First-Order Dialog Gating:
Risk: First-time visitors on the home page will no longer see <FirstOrderPromoDialog /> or <Promotion /> modals.
Status/Mitigation: Intentionally removed per Redmine Task #11764 requirements to optimize home page speed and eliminate intrusive popups. Promotional coupons remain active and applicable during checkout.
Multi-Tenant URL Matching:
Risk: Multi-tenant URLs (e.g., /:tenantId/:storeId/home) could fail simple equality checks (pathname === '/home').
Status/Mitigation: Solved using regular expressions /\/home\/?$/i.test(window.location.pathname) across route guards.

Edit Copy Actions

Also available in: Atom PDF