Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Closes #540: Return schema.org-compliant pricing information. #541

Merged
merged 2 commits into from
May 24, 2016

Conversation

gavinballard
Copy link
Contributor

No description provided.

@cshold
Copy link
Contributor

cshold commented May 24, 2016

money_without_currency will still return the symbol, just not CAD or USD. The docs are a bit confusing - I'll get them updated.

Instead, you can use content="{{ current_variant.price | divided_by: 100 }}"

cc @carolineschnapp

@cshold
Copy link
Contributor

cshold commented May 24, 2016

I may have spoke too soon, hold tight.

@gavinballard
Copy link
Contributor Author

gavinballard commented May 24, 2016

I think you may have because money_without_currency seems to work fine on the various themes I've used it with :).

@cshold
Copy link
Contributor

cshold commented May 24, 2016

The problem arises with changing the money format to amount_with_comma_separator. It causes an error in Google structured data testing tool:
image

Instead, we should use content="{{ current_variant.price | divided_by: 100.00 }}. This works with any money format and maintains the decimals.

Any objections @stevebosworth @m-ux @carolineschnapp?

@gavinballard
Copy link
Contributor Author

Are there problems then if the currency doesn't use decimals? For example, here in Sweden all prices are just in SEK, without öre (cents). Does Shopify store 600 SEK as a price of 60000, or 600?

@cshold
Copy link
Contributor

cshold commented May 24, 2016

We're in the clear there.

If you have say $199.99 defined in CAD or USD then switch to SEK, it's rounded to SEK but still stored as the decimal value. Best explained below:
sek
That means {{ product.price | divided_by: 100.00 }} would still give you 199.99.

If you update the price to 200 even, then {{ product.price | divided_by: 100.00 }} would be 200.0, which is valid to Google:
image

To answer your initial question, yes, 200 SEK is 20000 with {{ product.price }}

@gavinballard
Copy link
Contributor Author

Awesome, just updated the pull request.

@cshold cshold merged commit f94f1d8 into Shopify:master May 24, 2016
@cshold
Copy link
Contributor

cshold commented May 24, 2016

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants