Phase 6:
Custom VAT Pricing

Inc/exc tax toggle with sale price support across PDP, collection & cart

WinSport Theme · price-vat Snippet · Theme Settings · Metafield-gated

Why Custom VAT?

4
Surfaces
3
Settings
1
Snippet
0
JS Required

B2B and international stores need flexible tax display. Shopify’s built-in tax logic is limited to store-level settings. Phase 6 adds per-product VAT control via metafields, a theme-level toggle with configurable rate, and sale price support — all in pure Liquid with zero JavaScript.

Theme Settings

vat_enabled

Enable VAT Display

Global toggle — checkbox in theme settings. Off = zero VAT output anywhere.

vat_rate

VAT Rate (%)

Range slider 0–30%, step 0.5%. Default 20%. Used in all calculations.

vat_prices_include_tax

Prices Include Tax

Determines formula direction: extract excl. from incl., or add incl. to excl.

Per-product gating: custom.show_tax boolean metafield — only products with true show VAT

PDP VAT Display

VAT Breakdown on Product Page
PDP with VAT price breakdown showing Incl. and Excl. VAT
  • Rendered by price-vat.liquid snippet below the price block
  • compare_at_price passed from variant — triggers sale mode
  • Old prices shown with <s> strikethrough
  • Formula: prices include tax → excl = price × 100 / (100 + rate)
  • Formula: prices exclude tax → incl = price × (100 + rate) / 100

Collection & Cart Items

card-product.liquid

Collection Cards

VAT breakdown below each card price. Passes compare_at_price for sale items. Inline on desktop, stacked on mobile.

main-cart-items.liquid

Cart Line Items

Per-item VAT below line price. Uses item.final_line_price which accounts for quantity and discounts.

cart-drawer.liquid

Cart Drawer Items

Same per-item VAT in the slide-out drawer. Consistent display across both cart experiences.

Cart VAT Totals

Cart Footer VAT Summary
Estimated total £599.97
Excl. VAT: £499.98
VAT (20%): £99.99
Incl. VAT: £599.97
  • Iterates cart.items and sums VAT for items with show_tax = true
  • Non-taxed items excluded from VAT subtotal — only relevant products contribute
  • Same logic in both main-cart-footer and cart-drawer
  • Shows only when at least one taxed item exists in cart
  • Separated from main total by a subtle border

Code Highlights

{# price-vat.liquid — sale price support #}
{%- if settings.vat_enabled and product.metafields.custom.show_tax.value == true -%}
  {%- if compare_at_price and compare_at_price > price -%}
    {%- assign on_sale = true -%}
  {%- endif -%}

  {# Calculate VAT for current price #}
  {%- assign divisor = 100 | plus: vat_rate -%}
  {%- assign excl_price = price | times: 100 | divided_by: divisor -%}

  {# Strikethrough for original price when on sale #}
  {%- if on_sale -%}
    <s class="price-vat__compare">{{ compare_incl | money }}</s>
  {%- endif -%}

{# Cart totals — aggregate VAT across items #}
{%- for item in cart.items -%}
  {%- if item.product.metafields.custom.show_tax.value == true -%}
    {%- assign cart_vat_total = cart_vat_total | plus: line_vat -%}
  {%- endif -%}
{%- endfor -%}

Data Flow

Theme Settings vat_enabled
vat_rate
vat_prices_include_tax
price-vat.liquid Shared snippet
VAT calculation
4 Surfaces PDP · Cards
Cart · Drawer
Metafield Gate custom.show_tax
per-product boolean
Cart Totals Aggregated loop
Only taxed items

Key Takeaways

  • Pure Liquid — all VAT calculations use Liquid math filters, zero JavaScript
  • Single snippet, multiple surfacesprice-vat.liquid reused across PDP, collection cards, and cart
  • Sale price awarenesscompare_at_price parameter shows strikethrough VAT for discounted items
  • Per-product controlcustom.show_tax metafield gates visibility per product
  • Cart-level aggregation — footer and drawer sum VAT only for taxed items
  • Fully configurable — rate, direction (incl/excl), and toggle all in theme settings

WinSport Theme · Phase 6 Complete · Dawn v15.4.1 · Shopify 2.0