Home › Forums › Ticket Products › Event Tickets Plus › Add to Cart button inside of month template view
- This topic has 5 replies, 2 voices, and was last updated 8 years, 7 months ago by Brian.
-
AuthorPosts
-
October 7, 2015 at 5:03 pm #1012542JustinParticipant
I can see on individual event pages the add to cart gets pulled in via the
tickets.php
template to create add to cart ability, I’d like to make that template available inside of themonth/single-event.php
template.Is this possible? How might I go about this?
Thanks,
Justin
October 8, 2015 at 7:47 am #1012709BrianKeymasterHi,
Thanks for using our plugins I can try to help out here.
We do not have a feature to do this so I am limited in supporting it.
However, you could try using a WooCommerce Shortcode to add the ticket in month view:
<?php echo do_shortcode( '[add_to_cart id="309"]'); ?>
I tested it out and was able to add a ticket to the cart.
It would need some coding to detect the ticket product id and add it to the shortcode or else the same ticket would be in all events.
Or you could create a custom field using ACF and add the shortcode there and then only run it if there is content in the custom field for that event.
I can try to help out and answer some more questions to get you started, but I am limited in support a customization much beyond this.
Thanks
October 9, 2015 at 2:07 pm #1013300JustinParticipantThanks Brian,
So I have a solution using ACF that works though isn’t as streamlined as I would like.
<a href="/?add-to-cart=<?php the_field('woo_post_id');?>">
It’s nothing ground breaking but requires the user to enter the WooCommerece product ID into a field on the edit events page and then we have a click to add product to cart button in the menu.
In an effort to make this more dynamic & streamlined, is there any way to access the Woo product ID from within the events loop?
October 12, 2015 at 6:01 am #1013603BrianKeymasterHi,
What about using this method outlined here:
$woo_tickets = Tribe__Events__Tickets__Woo__Main::get_instance();
$ticket_ids = $woo_tickets->get_tickets_ids( get_the_id() );foreach ( $ticket_ids as $ticket_id ) {
printf( '<h3>%s</h3>', get_the_title( $ticket_id ) );
}I am not sure if get_the_id() works there, but that is just the event id you might be able to directly add it there from a variable.
Anyway this returns all the ticket ids for an event.
If it finds an id you could then display the add to cart button by replacing the printf() function.
Do you think that will work?
October 13, 2015 at 12:22 pm #1014241JustinParticipantBrian –
That seems to be returning the event ID and not the WooCommerce product ID.TBH, I’m going to tell the client this is out of their development scope before I start going over budget.
Thanks for all your help!
-Justin
October 13, 2015 at 3:40 pm #1014316BrianKeymasterOk Sounds good, I did not test in the Month View so maybe there is needs to be modified.
Since this is marked resolved I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic on the forum and we can help you out.
Thanks
-
AuthorPosts
- The topic ‘Add to Cart button inside of month template view’ is closed to new replies.