Check for the existence of productId before using it (https://github.com/woocommerce/woocommerce-blocks/pull/480)
This commit is contained in:
parent
0f473aaa07
commit
7dc5187b4b
|
@ -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 '';
|
||||
|
|
Loading…
Reference in New Issue