Beta 3: WooCommerce Layout Builder - Hooks don't seem to work

So not sure what is or isn’t coming with the archive builder.

Another thing I have noticed is that if I build a single product page with the builder the usual WordPress / Woo hooks don’t work.

At the moment the Woo product single page builder is very limited so if there is something we need to hook into the page how do we do this?

Hi @urchindesign,

We have some WooCommerce specific elements coming, and some dynamic content powered elements that will allow recreating things like the WooCommerce tabs. That said, none of these changes fire any WooCommerce specific hooks.

Any specific hooks you’re looking for? Or any use cases you have in mind that we should be considering? Thanks!

I hadn’t really thought that far. I was just testing if it was possible to hook into the pages with the woo hooks.

By example there are times where we want add something to a set of products in a particular category or whatever. If it is a large shop I’ll often then use a hook with a conditional.

In theory this is a layout builder so we could really add things into the layout and create different layouts based on conditions. The only problem I see is that there is no conditional option (unless I missed it). Ideally it would be awesome if the elements (rows, columns, images, buttons etc. ) had the ability to have conditionals in the same way the header builder / layout builder does. This way we can build a layout and then have conditionals so that portions of the layout only display based on the conditionals. It just feels like needing to make a ton of layouts to add some something simple makes things tricky. We’re going to end up where we are with the headers. We’ll end up with 10 different layouts for a WooCommerce page and then when we need to change some of the standard stuff we’ll need to make changes on 10 layouts.

Side issue if I build a layout with optional items, if you don’t add something to the optional custom field or even the feature image or whatever then the item is visible on the front end. So if I build a layout that utilises a custom acf image but the client doesn’t add one because it isn’t needed for that particular cpt then the front end shows a broken image. Or if for some items the client needs a button to a downloadable pdf and on other pages they don’t then the button displays with no link. In both these types of scenarios it is better if the item isn’t displayed on the front-end.

Probably once we have a more complete look at the layout builder and the woo integration I’ll have more thoughts on this.

2 Likes

Hi @urchindesign,

Thanks for sharing all this, and I apologize for the delay. We ended up taking some more time to work on WooCommerce specific items and we believe most use cases are covered.

We did end up getting in a way to do per element conditions using a control similar to the assignments. We’ve wanted to get that in for a while, and WooCommerce integration in particular is what helped us prioritize it for this update. One use case in particular is needing to check if a product is on sale before outputting different pricing. It would be very cumbersome to have to manage multiple layouts for small adjustments like that.

This means you can now make a Header and have individual elements output based on query conditions, or things like the user being logged in.

On your point about optional items, maybe those are things we can look into and add more conditions for. Looking forward to getting your feedback once we push this next beta out!

3 Likes