Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show discount in Schema.org

I have a product which has reduced price. I want to show both prices - original and discounted. Is there a way to mark this in Schema.org?

For now I have something similar:

<ul class="productPriceList" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
     <li class="productPriceList">
         <div class="price red"><span class="" itemprop="price">4302</span>&nbsp;<span itemprop="priceCurrency" content="USD">$</span></div>
         <span class="price crossOut" itemprop="price">26890</span>&nbsp;<span itemprop="priceCurrency" content="USD">$</span>&nbsp;<span class="product-promo">84</span>%&nbsp;off
     </li>                  
</ul>

This shows as:

offers  
     @type: Offer
     price: 4302
     priceCurrency: USD 
     price: 26890
     priceCurrency: USD 
like image 658
Irina Marinova Avatar asked Jun 16 '16 13:06

Irina Marinova


1 Answers

Your current markup doesn’t convey which price is the old/new one. You shouldn’t use that.

You could use two PriceSpecification items instead (as value for the priceSpecification property). With validFrom and validThrough you can specify the dates when the old price was valid and since when the new price is valid.

<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">

  <div itemprop="priceSpecification" itemscope itemtype="PriceSpecification">
    <s>$ <span itemprop="price">26890</span></s>
    <meta itemprop="priceCurrency" content="USD" />
    <meta itemprop="validThrough" content="…" />
  </div>

  <div itemprop="priceSpecification" itemscope itemtype="PriceSpecification">
    $ <span itemprop="price">4302</span>
    <meta itemprop="priceCurrency" content="USD" />
    <meta itemprop="validFrom" content="…" />
  </div>

</div>

(Note that the span element can’t have a content attribute in Microdata. I replaced it with a meta element.)

like image 138
unor Avatar answered Nov 09 '22 09:11

unor