Skip to content

Cart page fires redundant GET /checkout/cart/?ajax=1 when displaying prices including tax #41100

Description

@khoimm92

Preconditions and environment

  • Magento Open Source 2.4.9 (also present on current 2.4-develop)
  • Store configuration:
    • Stores > Configuration > Sales > Tax > Shopping Cart Display Settings > Display Prices = Including Tax (tax/cart_display/price = 2)
    • Display Subtotal = Including Tax (tax/cart_display/subtotal = 2)
  • Luma or any theme that uses Magento_Checkout/js/cart/ensure-subtotal-sync (wired from cart/form.phtml)

Steps to reproduce

  1. Set cart price / subtotal display to Including Tax (values above) and flush config + full page cache.
  2. Add any simple product to the cart.
  3. Open /checkout/cart/ and wait for Knockout cart totals to render.
  4. In the browser Network panel, filter for checkout/cart.

Expected result

No automatic full-page cart HTML reload after paint when the table row subtotals already match the summary subtotal.

Actual result

The browser issues a redundant:

GET /checkout/cart/?ajax=1&_=<timestamp>

Magento_Checkout/js/cart/ensure-subtotal-sync sets body.cart-synced = true and replaces #form-validate.

Additional information

Root cause

getCentralSubtotal() only sums:

'#shopping-cart-table .col.subtotal .price-excluding-tax .cart-price'

With including-tax display, Magento's row price template renders .price-including-tax .cart-price and does not render .price-excluding-tax. The central sum stays 0, the summary subtotal is non-zero (e.g. $22.00), so trySync() always treats the cart as out of sync and reloads the cart HTML once.

Confirmed locally: with tax/cart_display/subtotal = 2, excl-tax nodes are empty, incl-tax nodes match the summary, and Magento still fires ?ajax=1.

Suggested fix

Prefer excl-tax prices when present (both-prices mode), otherwise fall back to incl-tax, then bare .cart-price.

File: app/code/Magento/Checkout/view/frontend/web/js/cart/ensure-subtotal-sync.js

Release note

Shopping cart no longer issues a redundant AJAX reload when cart prices are displayed including tax.

Triage and priority

  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Other Developer ToolsComponent: ConsoleIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Reported on 2.4.9Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    Status
    Ready for Development

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions