We set the template (and therefore the locale and language) in our add to cart buttons, via
<input name="template_set" type="hidden" value="xxxxxxx" />
We also have a button in the header, that just calls for viewing the cart - this works well if the template and language have already been set by adding a product.
We have a minor issue, however, if the customer tries to view the (empty cart) before adding the product - the cart defaults to English.
Here is our question:
Is it possible , when outputting the header, to query whether a locale is already set in the json object ; and store the answer in a PHP $variable?
[Then, based on the outcome, we would either:
- do nothing if a template was already present
- use the Geoip info to chose and set a locale using PHP and
echo ' <input name="template_set" type="hidden" value="xxxxxxx" /> '
added to the view cart form]
Site runs on word press and sample test page is at http://testml.isails.com/laser-store/