Add this to the head of your single-product.php page in the woocommerce directory of your theme. This will enable a rich result on Google, Rich pin on Pinterest etc
add_action( 'wp_head', 'ns_tc_product_json_ld' );
function ns_tc_product_json_ld(){
global $product;
?>
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": "<?php echo $product->get_name();?>",
"image":
"<?php echo genesis_get_image(
array(
'format' => 'url',
'size' => 'full',
)
);?>",
"description": "<?php echo get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true);?>",
"mpn": "<?php echo $product->get_sku();?>",
"brand": {
"@type": "Brand",
"name": "My Brand"
},
<?php
if ($product->get_review_count() > 0) { ?>
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "<?php echo $product->get_average_rating();?>",
"reviewCount": "<?php echo $product->get_review_count();?>"
},
<?php } ?>
"offers": {
"@type": "Offer",
"url": "<?php echo get_permalink();?>",
"priceCurrency": "GBP",
"price": "<?php echo $product->get_price();?>",
"priceValidUntil": "2020-12-31",
"itemCondition": "https://schema.org/NewCondition",
"availability": "https://schema.org/InStock",
"seller": {
"@type": "Organization",
"name": "My Organization"
}
},
"sku": "<?php echo $product->get_sku();?>"
}
</script>
<?php
}