Woocommerce Product Schema


<?php
/*
**Use this template: yourtheme/woocommerce/single-product.php.
*/
if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } get_header( 'shop' ); ?>
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": "<?php echo $product->get_name(); ?>",
"image": ["<?php echo get_the_post_thumbnail_url( $product->get_id(), 'full' ); ?>"],
"description": "<?php echo strip_tags($product->get_description()); ?>",
"sku": "<?php echo $product->get_sku(); ?>",
"url":"<?php echo get_permalink( $product->get_id() ); ?>",
"brand": {
"@type": "Thing",
"name": "Example Company"
},
<?php if($product->get_review_count() >= 1 ){ ?>
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "<?php echo $product->get_average_rating(); ?>",
"reviewCount": "<?php echo $product->get_review_count(); ?>"
},
<?php } ?>
"offers": {
"@type": "Offer",
"priceCurrency": "AUD",
"price": "<?php echo $product->get_price(); ?>",
"itemCondition": "http://schema.org/NewCondition",
"availability": "http://schema.org/InStock",
"seller": {
"@type": "Organization",
"name": "Example Company"
}
}
}
</script> 
Want a Fast Server Like Mine?

GET VULTR!