Here is it
<script type="application/ld+json">
{
"@context": "
https://schema.org/",
"@type": "Product",
"name": "<?php echo osc_esc_html(osc_structured_data_title()); ?>",
<?php if($image_url <> '') { ?>"image": "<?php echo osc_esc_html($image_url); ?>",<?php echo PHP_EOL; } ?>
"description": "<?php echo osc_esc_html(osc_highlight(osc_structured_data_description(), 200)); ?>",
"mpn": "<?php echo osc_item_user_id();?>",
"sku": "<?php echo osc_item_id(); ?>",
"brand": "<?php echo osc_esc_html(osc_item_title()); ?>",
<?php if(1==2) { ?>"sku": "OSC-<?php echo osc_item_id(); ?>",<?php echo PHP_EOL; } ?>
"offers": {
"@type": "Offer",
"itemOffered": "<?php echo osc_esc_html(osc_item_title()); ?>",
"url": "<?php echo osc_esc_html($url); ?>",
<?php if(osc_item_price() > 0) { ?>"priceCurrency": "<?php echo osc_esc_html(osc_item_currency()); ?>",<?php echo PHP_EOL; } ?>
"price": "<?php echo osc_esc_html(osc_item_price() > 0 ? osc_item_price() : 0); ?>",
"priceValidUntil": "<?php echo date('Y-m-d', strtotime(osc_item_field('dt_pub_date') . ' + 365 days')); ?>",
"availability": "
https://schema.org/InStock"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "<?php echo round(osc_count_item_comments_rating(), 1); ?>",
"bestRating": "5",
"worstRating": "0",
"ratingCount": "<?php echo (osc_count_item_comments() > 0 ? osc_count_item_comments() : 1); ?>",
"reviewCount": "<?php echo (osc_count_item_comments() > 0 ? osc_count_item_comments() : 1); ?>"
}
<?php osc_run_hook('structured_data_footer'); ?>
}
</script>
<?php } else { ?>
<script type="application/ld+json">
{
"@context": "
http://schema.org/",
"@type": "Organization",
<?php if($image_url <> '') { ?>"logo": "<?php echo osc_esc_html($image_url); ?>",<?php echo PHP_EOL; } ?>
"name": "<?php echo osc_esc_html(osc_structured_data_title()); ?>",
"url": "<?php echo osc_esc_html($url); ?>"
<?php osc_run_hook('structured_data_footer'); ?>
}
</script>