duncanmcclean / simple-commerce

A simple, yet powerful e-commerce addon for Statamic.
https://statamic.com/addons/duncanmcclean/simple-commerce
Other
143 stars 36 forks source link

[5.x] Improvements around tax display #922

Closed duncanmcclean closed 11 months ago

duncanmcclean commented 11 months ago

This pull request implements some improvements around how tax is displayed, especially when tax isn't included as part of product prices.

Improvements

Add {{ sc:cart:shippingTotalWithTax }} tag

A new shippingTotalWithTax method has been added to the {{ sc:cart }} tag. This allows you to get the shipping total, inclusive of tax.

{{ sc:cart:shippingTotalWithTax }}

Fix {{ sc:cart:itemsTotalWithTax }} tag

This PR fixed an issue I spotted with the itemsTotalWithTax method on the {{ sc:cart }} tag. When this tag was used in conjunction with shipping tax, the returned calculations would be incorrect.

Now, the total inclusive of tax will just run through the tax totals for each of the line items rather than relying on the tax_total field.

Line Items: Added totalIncludingTax method

A new method has been added to the LineItem class, allowing you to get the line item total including any taxes relating to that line item.

$lineItem = $order->lineItems()->first();

$lineItem->totalIncludingTax();

Totals in email should all include tax, if tax is included in prices

When the included_in_prices setting is true in the tax engine config, totals in Simple Commerce's built-in order emails will be displayed inclusive of tax.

The 'Tax Total' row has been removed from the order summary table in these cases.

To Do

github-actions[bot] commented 11 months ago

Released as part of v5.6.0.