From 36e9b73ef36095c524ed73313a1d61b14d0b1549 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 6 Apr 2017 12:40:53 +0100 Subject: [PATCH] Make sure we have a product before generating JSON --- includes/class-wc-structured-data.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/class-wc-structured-data.php b/includes/class-wc-structured-data.php index 89f46e98fd7..7eef1875046 100644 --- a/includes/class-wc-structured-data.php +++ b/includes/class-wc-structured-data.php @@ -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();