From 7dc5187b4bf3572f5b0d1ff5d09d8ef0c83b5fe5 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Thu, 7 Mar 2019 17:01:53 -0500 Subject: [PATCH] Check for the existence of productId before using it (https://github.com/woocommerce/woocommerce-blocks/pull/480) --- .../assets/php/class-wgpb-block-featured-product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/woocommerce-blocks/assets/php/class-wgpb-block-featured-product.php b/plugins/woocommerce-blocks/assets/php/class-wgpb-block-featured-product.php index bd3c851c03f..56f02e9784a 100644 --- a/plugins/woocommerce-blocks/assets/php/class-wgpb-block-featured-product.php +++ b/plugins/woocommerce-blocks/assets/php/class-wgpb-block-featured-product.php @@ -46,7 +46,7 @@ class WGPB_Block_Featured_Product { * @return string Rendered block type output. */ public static function render( $attributes, $content ) { - $id = (int) $attributes['productId']; + $id = isset( $attributes['productId'] ) ? (int) $attributes['productId'] : 0; $product = wc_get_product( $id ); if ( ! $product ) { return '';