Make sure we have a product before generating JSON

This commit is contained in:
Mike Jolley 2017-04-06 12:40:53 +01:00
parent baaaf493d3
commit 36e9b73ef3
1 changed files with 4 additions and 0 deletions

View File

@ -180,6 +180,10 @@ class WC_Structured_Data {
global $product;
}
if ( ! is_a( $product, 'WC_Product' ) ) {
return;
}
$shop_name = get_bloginfo( 'name' );
$shop_url = home_url();
$currency = get_woocommerce_currency();