Forum
Formatting variant_desc
I wonder if there's a way to format the output of shop's variant_desc field. My products (tickets) have really long date and location strings and in the cart it would be much easier to see if there were <br/>s between the variants instead of commas. Thanks!
You could use a template filter for that https://docs.grabaperch.com/api/template-filters/
oh, wow. Perch 3!
So what field would I apply the filter to if it's the shop variant_desc I want to effect? Not even sure I know what template to attach the filter to...
It would be at the point it is output to the page.
I don't think that will work in this case because the variants are going to need commas as part of their content...
Can you split on another character?
so looking at the data, I would tguess this is the field I would want to applu the filter to:
I've added pipe characters here to show where the variants break.
So I think perch is adding the commas, between the variant options to build that field...
Maybe I'm misunderstanding something?
No, you'd be best to loop through the variants individually in that case.