Skip to content

❌ 🔗 Elementor AI module: Call to a member function get_gallery_image_ids() on bool #35388

@Blackfire0

Description

@Blackfire0

Description

Bug in Elementor AI module on WooCommerce 'Add New Product' page. The AJAX action elementor-ai-get-product-images sends an empty string [""] as post_ids because the product is not saved yet. In module.php (line 351), wc_get_product("") returns false, leading to Uncaught Exception: Call to a member function get_gallery_image_ids() on bool. A simple if ( $product instanceof \WC_Product ) check is missing.

Image Image

Steps to reproduce

Steps to reproduce:

Make sure WooCommerce and Elementor (with Elementor AI features enabled) are installed and active.

Go to your WordPress Admin dashboard.

Navigate to Products > Add New (which opens the /wp-admin/post-new.php?post_type=product URL). Do NOT save the product yet.

Open the browser's Developer Tools (F12) and go to the Network tab, or simply monitor your server's PHP error log (debug.log).

Notice that an automatic AJAX POST request is made to admin-ajax.php with the action: elementor-ai-get-product-images.

Check the payload of this request. Since the product is completely new and has no ID yet, it sends an empty string in the array: "post_ids": [""].

Expected behavior

The Elementor AI module should handle empty or invalid product IDs gracefully without causing a PHP Fatal Error.

Elementor System Info

-

Agreement

  • I confirm I have read and followed all the guidelines and instructions outlined in the Elementor Bug Report form.
  • I agree that my issue may be closed without further action if it doesn't meet all the requirements outlined in the Elementor Bug Report form.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIndicates when an Issue or a Discussion is a duplicate of another Issue or Discussion.integration/woocommerceReferences any component related to Elementor Pro’s WooCommerce Builder.mod*[Temp.] For internal use only.mod/b*[Temp.] For internal use only.mod/d*[Temp.] For internal use only.product/aiReferences any component related to the Elementor AI (Artificial Intelligence) product.product/proIndicates if the referenced component is part of the Elementor Pro plugin.widget/pro/wc/product/imagesReferences the WooCommerce Product Images widget (Pro), often referred as the Product Gallery.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions