Hide price from Product JSON

Roger_McEffort
Shopify Partner
43 0 6

How do you hide prices from a product's JSON?

I know how to physically remove it from the page, but the price is still visible if you add the .json suffix to the product in the URL .

0 Likes
David_Weru
Trailblazer
129 9 21
haranaybgroup
New Member
1 0 0

The basic approach I see a lot is just removing the price HTML from the theme. That sounds like it will work okay but there are a few other places that your prices could "leak" if you’re trying to thoroughly hide them from customers.

First, some themes add tags or other types of invisible data to the page like Facebook OpenGraph tags which are used when people share the page. It’s common to see the price of a product in here (e.g. og:price:amount).

Removing these are easy, they a just a quick edit to your theme.

Second, Shopify has an analytics system for stores that tracks page views, sales, and other metrics you see in their reports. As part of this, they export and use the prices of all of the product variants on the page in JavaScript. Anyone who knows where to look and knows HTML can find that in a few seconds.

From what I can tell, you can’t remove this at all.

Finally there are also two hidden urls in Shopify for products in addition to the main product page. To find them,

  1. take a url for your product
  2. remove the last slash if there’s one at the end
  3. add either .js or .json to the end (you might need to use the View Source option to see the data)

This is the JSON view of your product. In there are your variants and prices again, along with a bunch of other data.

(JSON is programmer-speak for a specific data format. It’s similar to JSON-LD from my app but used differently.)

For example, simakara monocular review

Product page: https://json-ld-for-seo-demo.myshopify.com/products/aerodynamic-aluminum-bench

JS Product page: https://json-ld-for-seo-demo.myshopify.com/products/aerodynamic-aluminum-bench.js

JSON Product page: https://json-ld-for-seo-demo.myshopify.com/products/aerodynamic-aluminum-bench.json

You’ll also notice that all variants are shown with their prices so if you’re hiding variants on the main storefront page, they still might be showing up here.

These are built into Shopify and I’m not sure if there’s any way to turn them off or disable them. I also know some apps use them behind the scenes too so even if you could turn them off, it could break something else.

If you want to completely hide prices in Shopify you need to make a decision about how much work you want to do.

  1. Settle for hiding them in the visible page and ignore the other places someone could discover them, or
  2. Setup your products so the only prices shown in Shopify are ones you’re okay with leaking (e.g. MSRP, your highest price), or
  3. Require everyone who visits your store to have an account, which still might not block the special .js or .json urls.

Shopify’s wholesale channel seems like it’s a version of #3 but it’s for Shopify Plus only at this time.

Completely hiding prices is sadly, nearly impossible in Shopify.

Once great optimization is to make sure your product’s structured data is setup correctly for Google’s Rich Snippets. With those you’ll get more traffic and better converting traffic.

You can either audit your store’s structured data by hand or install JSON-LD for SEO and have all the structured data you need.

It’s already helping over two thousand Shopify stores with their structured data and it could help you too.

Eric Davis

0 Likes
David_Weru
Trailblazer
129 9 21

@anna12352 

This is an example from your store:

I'll add a .json in a link below pointing to one of your products.  This info about products is always accessible.  

https://datsuzokudecor.com/products/akarui-plates?variant=37455792865436

https://datsuzokudecor.com/products/akarui-plates.json?variant=37455792865436

0 Likes
Roger_McEffort
Shopify Partner
43 0 6

@David_Weru wrote:

The json for product info is always accessible.

 Another ridiculous Shopify quirk. I suppose it is what it is then. 

0 Likes
David_Weru
Trailblazer
129 9 21

@Roger_McEffort, from a development standpoint, it limits pings to the server by having all that data upfront and leaving theme developers room on how to present it.   

Private data thankfully is hidden away.  I'd contact support about this.  Maybe they know how to filter data which gets served out.  (Might break features using that data afterwards but can't hurt to ask.)

0 Likes