thegeneralyst/AnopaDocs
Cart

Cart Subtotal

Displays the cart total cost, re-fetching variant prices per active market to show a localised total.

What it does

AP_CartSubtotal displays the cart's total cost. When a market is active, it re-fetches each variant's price in context to show the localised total rather than the stored base price. Currency symbol and code are automatically populated from the active market.

How to set it up

Place AP_CartSubtotal anywhere in your cart drawer. No configuration is needed for currency handling, as the symbol and code are drawn from the active market. For design work in the canvas, set a preview total value so you can style the component without needing live cart data.

Key behaviours

  • Calculates the total by fetching each variant's market-context price via the Shopify Storefront API
  • Falls back to stored prices when no market is set
  • Fades to 50% opacity during re-fetching and restores automatically when complete
  • Canvas shows a static preview price for design work

Property Controls

ControlTypeDefaultDescription
Preview TotalString240.00Canvas-only preview value used to display a static total for design and styling.
DecimalsNumber2Number of decimal places to show in the displayed total.
Show SymbolBooleantrueToggle display of the currency symbol (e.g. $), auto-set from the active market.
falseToggle display of the currency code (e.g. USD), auto-set from the active market.
Font16px
Color#111111Text color for the displayed cart subtotal.