Archived topic
Using GPP 2.0 Block Element to override single product item in search results
4 replies · Started by Stephane Bergeron on May 1, 2021
Hi!
I'm trying to do something and wondering if anyone has achieved it.
I want to modify the search results archive on a client site and display items that are products with some product related data (price, add to cart button, etc.). I'm easily able to target the product items and override their display (GPP 2.0 is truly amazing) but I have no way to actually display product related meta data l;ike price, etc. Most WooCommerce blocks plugins concentrate on blocks to create product archives or filters or whatever. None offer the basic building blocks like price, add to cart button and others in a way that I can. PootlePress' WooBuilder has those blocks... but they are unavailable outside the actual WooCommerce single product edit screen.
I also tried using GenerateBlocks dynamic data but with variations, custom field names repeat and it's hard to get at the actual data, especially since there's no way to add conditions.
Does anyone know of a blocks plugin that would actually have the basic product elements and that work in a GPP Block Element layout?
Long shot I know but thought I'd try to ask here anyway :)
Hi there,
I wish WooCommerce would release small blocks that handle all of the "blocks" inside their template. It seems like kind of a no-brainer. I'm hesitant to do it, as it really should be in WC core.
If it was me, I would build these elements into shortcodes, then integrate the shortcodes into my Content Template.
You can use custom fields in Content Templates, but I don't think WC stores much of that data as custom fields, unfortunately. So, custom blocks or shortcodes are likely your best bet.
Hi Tom,
Yes, shortcodes is what I was thinking as well but I was hoping there may be another way. I actually found that Toolset has those basic products building blocks, but I'd need to install 3 plugins to get them... Types, Toolset Blocks AND Toolset WooCommerce Blocks. And in the Element editing screen, those blocks display nothing so they are hard to select unless you constantly go to List View (which we really should be able to dock somewhere permanently... the general Gutenberg UX remains extremely frustrating to me...).
Thanks for the help Tom!
...and you are right... I was actually kind of stunned to see those basic blocks do not exist in WooCommerce Blocks. Indeed a no-brainer to me as well.
Hopefully it's something they do with FSE around the corner :)