Add a note to a product in the cart...
We are using Shop to sell tickets to courses. Each course may have multiple venues/dates. How should I set this up?
Requirements are that the dates in the past disappear from the site, and the user can add the course to their cart with a particular date associated.
I could create a new product for each instance, but I'd rather not have to do that - it makes things harder for the admin and would end up duplicating work for them.
I'd thought about using the Events app to manage each instance of a course. That obviously helps to handle to the past dates disappearing requirement, and gives me options for displaying calendars etc but I don't know how I'd associate an instance of an event with the product in the cart.
My other thought is to create a product option option for each event (which would obviously be associated with the product in the cart) but wouldn't disappear automatically, unless there's a way to filter the options somehow?
Advice would be great. Thanks!
I would probably add the dates as product options. Would that work?
I will try that. Is there a way to remove a product option from the front end after the date has passed?
I've not tried it, but you can add other fields to the options. You should be able to add one that is a date and then use it to filter when looping through the options.
Cool - that sounds good to me.
I've tried that - I can add a date. I've not tried to filter on it yet, but I'm fairly sure I could. The workflow isn't ideal for my client though - they have to create the option, then go to the product and add the option to it. If they only had to create the product, it would be OK I think.
Is there a way that you can add a free-text field to a product as you add it to a cart - eg notes? I'm fairly sure I could get this populated with event dates? That's looking like my slightly preferred option.
That functionality doesn't exist yet, but it's on the roadmap as "Product customisations".
OK cool, thanks Drew. I guess "Order Notes" is also on there (similar to notes, but appllied to a whole order). Enjoying Perch Shop so far though - really great job.
My Options template is as follows:
I've added the date field in the repeater, but it doesn't save the data. Is there something I should do to get it save the data? How would I access it in my template?
Looking at this... https://forum.grabaperch.com/forum/05-12-2016-option-image-does-not-save
Is it not possible to adding an extra field to the options?
Having checked again, I see you can add dates to a Variant, rather than an option, so I can do that, but again I couldn't work out how to output the value, or filter on it.
What have you got?
Here's my variant template
Here's my add to cart form, which shows all my options
Each course date is a variant, with a course start date. I can't work out to display the course date.
Here's the template with some <perch:showall /> tags in at different points to give me the different available variables.
The first showall gives me this:
The next gives me this:
The other one I get is this:
Here's the diagnostic
Was this info any help? Any suggestions?
There's rather a lot of make sense of there. Where are you doing the filtering?
My idea is to have it in my "Add to cart" form (second code block down in my earlier crazy-long post) - I only want to display options relating to course start dates in the future. As a step on the way to that, I was trying to be able to display the start date - I figure if I can't display it I can't filter on it. (Hence all the
perch:showall
stuff). Sorry, it was a bit much...I guess I would ideally put the custom date field into the option as part of the repeater, but that doesn't seem to save. So I tried putting it on the variant, which does save, but I can't seem to output it.
You can't add fields to the option value, just to the option. Are you trying to add to the option value?
Thanks, Drew - initially I was trying to add fields to the Option Value. It doesn't really help me to add fields to the option I don't think...? Can I add fields to the Variant instead? The field I added in the template shows up and saves, but I can't output or filter on it.
Yes, you should be able to both output and filter on it.
That was my thinking, but it's not showing up when I do a "Showall". Can you point me in the direction of why it might not be showing up?
What code have you got? How are you displaying the variant?