schema.orgmicrodata

What is the correct way of using the price schema in microdata format?


I have read http://schema.org/price (Microdata example) and I want to use on one of my page.

This is what is of interest to me, I want to show price/price-range

<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
    <!--price is 1000, a number, with locale-specific thousands separator
    and decimal mark, and the $ character is marked up with the
    machine-readable code "USD" -->
    <span itemprop="priceCurrency" content="USD">$</span><span
          itemprop="price" content="1000.00">1,000.00</span>
    <link itemprop="availability" href="http://schema.org/InStock" />In stock
  </div>

Now my page is not showing any price until some options are selected on the page, however I do have a base price (minimum) which I want to use in this case.

How and where would be the correct place to inject this base price?

I tried this on https://search.google.com/structured-data/testing-tool and it works. Not sure if this the correct way?

<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
    <meta itemprop="priceCurrency" content="USD" />
    <meta itemprop="price" content="2.31" />
</div>

enter image description here

Please advice.


Solution

  • Providing machine-readable values

    This is invalid:

    <span itemprop="priceCurrency" content="USD">$</span>
    <span itemprop="price" content="1000.00">1,000.00</span>
    

    You can’t use the content attribute on every element (it’s possible in RDFa, but not in Microdata).

    You could either use the data element with its value attribute, or the meta element, e.g.:

    <meta itemprop="priceCurrency" content="USD" />$
    <data itemprop="price" value="1000.00">1,000.00</data>
    

    Price range

    You can use the PriceSpecification type to provide a price range. It allows you to use the minPrice and maxPrice properties.

    You can add a PriceSpecification with the priceSpecification property to the Offer:

    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
      <div itemprop="priceSpecification" itemscope itemtype="http://schema.org/PriceSpecification">
        <!-- minPrice, maxPrice, priceCurrency -->
      </div>
    </div>