Product gallery element breaks the editor

Whenever I add the product gallery element in pro, the page where it’s added instantly breaks. i managed to “salvage” the content by removing the gallery image and then editing an existing text element. without doing that, I wouldn’t be able to preview the page nor would I be able to even save the page or edit it in WP (not PRO).

Here’s a sandbox site where you can see part of the issue (And even download a dump of the page for your testing, if needed): http://dangerous-panda-znzin7t4.sandboxcms.com/?auto=eyJ1c2VyIjoiZGVtbyIsInBhc3N3b3JkIjoidWZTZkF5cDYifQ==

I say “part of the issue” above because In here, weirdly i can save the page, but i can still see that the pro editor shows that “preview could not load” page and then it also can’t allow you to edit the page, but you can see its preview (which doesn’t happen on the live site).

However the problem is still there and you can see it :slight_smile:

The steps to recreate the page are the following:

  • Install WooCommerce and create a product (and add a feature image since this is what leads to the problem)
  • create a new page and open PRO there.
  • Now add a section and inside its column you can add a “product gallery” element
  • Save the page

Boom, the page is broken!

In the sandbox, the page that has the product gallery is called “product gallery error”. try to edit it or “edit with pro” and notice it just doesn’t work :frowning:

It looks like the workaround is to add a condition to the element, yet, please be aware of the problem (it’s happening in both 4.2.3 and the latest 4.3.X)

While we’re at it, can you also throw some documentation on how is this “product gallery” supposed to be used? i was just testing this element when i found this bug but i have no idea how it’s configured. i can only guess it’s a looper element or something? maybe that’s why it broke the page?

P.S: if you create a migration of the site, please make sure you remove the MU Plugin from the migrated page otherwise the site won’t work.

Hi @franticape,

Thanks for reaching out about this. I’ve confirmed this issue as well. The problem is it crashes anytime a product isn’t detected. The Product Gallery element was meant for use in the Layout Builder or when editing a Product in the Content builder. The element will output the image gallery you’re probably familiar with from WooCommerce single product views. We’ll look into what can be done to prevent the error in the content builder.

ah, i see, that makes more sense, i also thought it would work when templating pro (a feature I haven’t got to it yet since I find it a bit confusing because I haven’t read the documentation completely) but well, at least there’s a workaround in case anyone encounters this issue:

  • Set a condition. any will do. wait a few secs, afterward, and that’s it.

Thanks for sharing the workaround! Glad you found a way to correct it. In the latest update it should be more graceful and just show a placeholder unless there is a product available to pull the gallery images from.