Thanks.
The problem is that Shopify is getting in the way of us submitting consistent prices. I want to submit one price for everyone, but Shopify won’t provide me with the explicit variant price as it has been entered into the backend of the store, it is trying to be clever and modifying this price based on where it thinks the customer wants to ship it to.
I also do not want to have to punitively charge international customers 20% more just to placate Google. I also don’t want to have to set up international store(s) just to solve this problem when our UK store is configured to ship interntionally perfectly well. It duplicates the maintenance effort and costs for no good reason.
I would be satisfied if I could simply get something like variant.original_price or something, which returned the price entered into the Shopify backend explicitly. This would solve the problem.
I don’t really understand why it’s doing this. Geolocation is not 100% reliable, and there are instances where a customer might want to ship something to an address in the UK whilst not being in the UK themselves (or not appearing to be). They could be on holiday, they could be buying a gift and drop shipping it to someone, etc.
I have found a sortof solution, I think, but it is unreliable. There is a setting - cart.taxes_included - which you can query to determine whether the visitor (Google in this case) is seeing VAT inclusive prices in their cart. I’m not sure how reliable this is, since the Googlebot hasn’t added anything to the cart when they land on the website. It depends on how and when the cart object is instantiated, I guess.
At the moment I have some code that looks like this:
{%- assign variant_real_price = variant.price -%}
{%- if cart.taxes_included == false and variant.taxable -%}
{%- assign variant_real_price = variant.price | times: 1.2 | floor -%}
{%- endif -%}
This appears to work for the most part, but it often returns inaccurate numbers. For example, if we have a product that is 31.95 inc VAT, then the ex VAT price is 26.625. But the only price I can get out of Shopify (variant.price) for an international customer is a rounded number, 26.63. If I “times: 1.2” on this number I get 31.956, which rounded = 31.96, which is wrong.
If I use “floor” instead, as I have above, then a product that is 24.95 inc VAT (20.791666666666667 ex VAT) will be rounded to 20.79 by Shopify, and when I times that by 1.2 I get 24.948 - and if I use floor on that I get 24.94 - which is wrong.
