Home › Forums › Ticket Products › Event Tickets Plus › 'Book' button on event list page AND on Event Description
- This topic has 4 replies, 3 voices, and was last updated 10 years, 11 months ago by Barry.
-
AuthorPosts
-
May 9, 2013 at 2:04 pm #480981verticaParticipant
We want the ability to output a ‘Book’ button on the event listings page that has the woocommerce add to cart URL behind it so that customers can book tickets straight from the events list page.
We are also wanting the exact same button on the event description page.
There is something similar in the showcase page https://theeventscalendar.com/showcase-item/victoria-symphony/
Woocommerce, when it creates a product also creates a unique add to cart url for that product and it is that we want to look up and add to the page template.
Wootickets currently does this using a form but we no longer even have that – this is after Barry kindly fixed another problem for us so we don’t want to make any changes to his changes without some guidance.
Any suggestions?
May 9, 2013 at 3:39 pm #48114BarryMemberHi 1vertica,
With the same changes I suggested you make on your test site I don’t experience the same lack of a WooTickets form. We can definitely look into why that isn’t working for you (if you want to use the WooTickets default form that is).
In terms of adding an add to cart link, you could add these functions to your theme’s functions.php file. At the relevant point in your template you could then add:
<?php add_to_cart_wooticket_btns() ?>
Points to note: you need to do this in the context of an event, for instance next to the_content() or the_excerpt(), otherwise it will not know for which event you wish to obtain add-to-cart links.
Another point is that it adds items to the cart but does not take them to the actual cart page (it simply behaves as per the [add_to_cart_url] shortcode provided by WooCommerce).
Hope that gives you a starting point to work from 🙂
May 9, 2013 at 6:02 pm #48130MikeParticipantHow would one alter this code to also take them to the checkout page?
May 9, 2013 at 7:12 pm #48133BarryMemberIf you inspect the URL you can see there is a query appended like so:
?add-to-cart=x
Where x is the product ID. The WooCommerce [add_to_cart_url] shortcode seems to append this to the current page URL by default – but it also functions if you use it with the cart URL, something like:
example.com/cart/?add-to-cart=x
WooCommerce may offer a hook to simply change the behaviour of the shortcode, or you could even create your own function to build this.
May 20, 2013 at 7:07 am #49018BarryMemberI’ll go ahead and close this – as usual feel free to create new threads if you need further help on this end.
-
AuthorPosts
- The topic ‘'Book' button on event list page AND on Event Description’ is closed to new replies.