3

Is it possible to include any tax values in the price on the products page (not just the cart)?

2

I believe the only way to do this at present is to select the Include in Price option on the Tax Rate in Commerce settings.

  • 1
    I've done that, and it's had no effect. – Tam Oct 11 '16 at 14:21
  • @Tam I did a quick test on a vanilla Craft Commerce set up, the above option includes the tax within the price, so you'll need to adjust your price to include the tax amount (i.e. if you set the tax rate to 20% and the price of your product is normally £100 + tax, you need to set the price of your product to £120 (£100 + £20 tax)), but it is definitely included within the price on the product page. – Stephen Hamilton Oct 11 '16 at 14:29
  • So it doesn't increase the price by the tax amount, you have to do that manually no matter what? – Tam Oct 11 '16 at 14:32
  • @Tam Yeah, I believe the two options are: 1) display the tax as part of the price; or 2) have the tax be calculated separately as an adjuster. My understand is that adjusters can only be applied to an order model, not an individual product, so can only be calculated in the cart or during the checkout process. – Stephen Hamilton Oct 11 '16 at 14:39
  • I was afraid of that. – Tam Oct 11 '16 at 14:43
2

I made a really hacky way of applying 20% UK VAT to any value using a custom template variable. I expect you could grab Tax rule values from Commerce settings if you wanted the percentage to be dynamic.

{{ craft.businessLogic.taxAddedPrice( product.defaultVariant.price, 20 )|currency( cart.currency, true ) }}

public function taxAddedPrice( $productPrice, $percentage )
{
  return ( ( ( ( $productPrice ) / 100 ) * $percentage ) + $productPrice );
}
  • I ended up doing the same thing, but with a twig macro: {% macro tax(price) %}{{ (price * 1.2)|currency(craft.commerce.cart.currency) }}{% endmacro %} – Tam Oct 18 '16 at 11:57
  • 1
    Surely there must be a way of including tax in the display price? I've never seen an e-commerce shop that surprises you with tax at checkout. We are selling to multiple zones with different taxes, and want the tax to be included in prices, determined by users geo - location. Is there no way of doing this with craft out of the box? – ToddPadwick Oct 19 '17 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.