Product Gallery: add defensive check (#50495)
* Product Gallery: add defensive check * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
1fbfa83fb4
commit
3425a2c017
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: tweak
|
||||
Comment: Product Gallery: add defensive check to avoid fatal errors.
|
||||
|
|
@ -74,6 +74,10 @@ class ProductGalleryLargeImageNextPrevious extends AbstractBlock {
|
|||
|
||||
$product = wc_get_product( $post_id );
|
||||
|
||||
if ( ! $product instanceof \WC_Product ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$product_gallery = $product->get_gallery_image_ids();
|
||||
|
||||
if ( empty( $product_gallery ) ) {
|
||||
|
|
Loading…
Reference in New Issue