Archived topic
Woocommerce shortcode not rendering correctly and is a woo query loop possible?
5 replies · Started by Michael on September 2, 2022
Hi folks- two questions? (both related)
I'm able to display the products using a simple [products] shortcode, but when I add more parameters, they don't render on the front end.
[products category=”category-slug” columns=”4”] renders as one column. All the GP premium woo colors/fonts look great though.
I've seen another support topic that recommended a CSS band-aid, but was wondering if there is another, more structural solution?
Related to this question- If I find the Woo meta field names, is it possible to create my own product content template/card using elements and woo dynamic data, and just query loop these cards into my own woo shop page using Generateblocks? I'm a beginner of sorts, so apologies if this ignores other technical issues i might be unaware of.
Thanks as always!
Michael
Hi there,
by default the [products] shortcode will render whatever columns you define in the Customizer > Layout > Woocommerce settings.
If you want to break from that, then you will need to add the limit parameter eg.
[products limit="4" columns="2"]
So this will show 4 products in a 2 column grid. If you want all products then you can use -1 for the limit. e.g
[products category="category-slug" limit="-1" columns="2"]
Regarding the second question, ie. woo building with elements and generateblocks. No, not yet. We are looking at this, and the first step would be the product loop. But we have no timeline set.
David- thanks a ton. Got it all sorted!
By the way- why do you think the woo data fields are inaccessible/unable to be used in dynamic posts? Security issue? Business decision? Just curious.
Look forward to more GB goodness in the future.
cheers
Michael
Simple answer - Woo is complex.
We need to do a lot of integrations to make it work.
Simply retrieving the values from woos post tables wouldn't suffice. Most of those are parsed in woo specific functions that return what you see eg. a Price w/without tax or sales discount. And there are also dedicated functions such as the Add to Cart form, that A LOT of other plugins hook into.
But we will figure it out :)
belated thanks for the help on this! marking it as resolved. cheers-
You're welcome