Ensuring Accurate Cart Totals: Addressing Tax-Inclusive Shipping Adjustments in ESHOPMAN

Ensuring Accurate Cart Totals: Addressing Tax-Inclusive Shipping Adjustments in ESHOPMAN

In the world of headless commerce, precise financial calculations are paramount, especially when dealing with complex tax structures and promotional offers. ESHOPMAN, designed to power storefronts deployed via HubSpot CMS, provides robust tools for managing product variants, pricing, and promotions. However, the community recently highlighted an important scenario concerning how shipping method adjustments interact with tax-inclusive pricing, particularly when promotions offer 100% off shipping.

The Challenge: Negative Cart Totals with Tax-Inclusive Shipping Promotions

A critical observation from the ESHOPMAN community has brought to light a specific behavior that can lead to unexpected negative cart totals and subsequent payment processing failures. This occurs when:

  • A region is configured for tax-inclusive pricing (e.g., UK with 20% VAT).
  • A promotion applies a 100% discount to the shipping cost.

Under these conditions, ESHOPMAN's internal calculation for the cart_shipping_method_adjustment can incorrectly use the gross (tax-inclusive) shipping price instead of the pre-tax amount. This discrepancy has significant downstream effects.

Understanding the Discrepancy

Let's illustrate with an example:

  • Imagine a £10.00 tax-inclusive shipping price (including 20% UK VAT).
  • A promotion offers 100% off shipping.

Actual Behavior Observed:

The system creates a shipping adjustment with an amount of £10.00 (gross). Since the shipping method's amount is also £10.00 (tax-inclusive), the platform calculates the discount_total based on this gross adjustment. This effectively doubles the tax consideration, leading to a negative cart.total (e.g., £-1.50 on a £0.50 item).

This negative cart.total then propagates to the payment_collection.amount, causing payment gateways like Stripe to reject the transaction with errors such as: "This value must be greater than or equal to 1."

Expected Behavior for ESHOPMAN:

For a £10.00 gross shipping price with 20% VAT, the adjustment amount should correctly be £8.33 (pre-tax: 10.00 / 1.20). This would ensure:

  • Correct adjustment amount: £8.33 (pre-tax).
  • Accurate cart.total: £0.50 (item only, shipping fully discounted).
  • Valid payment_collection.amount: 0.50, allowing successful payment processing.

Impact on ESHOPMAN Storefronts and Development

This issue primarily impacts ESHOPMAN storefronts deployed via HubSpot CMS in regions utilizing tax-inclusive pricing and offering full shipping discounts. For developers working with the ESHOPMAN Admin API and Store API, understanding this calculation nuance is crucial for debugging and ensuring robust financial logic. While ESHOPMAN is built on a Node.js/TypeScript foundation to handle complex commerce operations, such specific interactions require precise handling within the platform's core logic.

What This Means for ESHOPMAN Users

This insight underscores the importance of rigorous testing for all pricing, tax, and promotion configurations, especially when migrating or setting up new ESHOPMAN storefronts. While the ESHOPMAN team continuously refines the platform to ensure accuracy, community vigilance helps identify and address these intricate scenarios. Merchants should be aware of how their promotional strategies might interact with regional tax settings, and developers should pay close attention to the calculated totals returned by the Store API.

The ESHOPMAN platform is committed to providing a seamless and accurate commerce experience. Identifying and resolving such calculation discrepancies is a priority to ensure that all transactions, from cart creation to payment processing, reflect the true financial intent.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools