Support

Home Forums Event Espresso Premium Add to cart on Event Listing Page

Add to cart on Event Listing Page

Posted: December 4, 2017 at 4:02 am


C9

December 4, 2017 at 4:02 am

Hello
I am using custom loop to show event listing on custom template.
all i need is to display add to cart button as well in respect to each event.


Tony

  • Support Staff

December 4, 2017 at 2:23 pm

Hi there,

Within your loop you should be able to call espresso_ticket_selector( $event ); to display the ticket selector for each event. You can’t currently add just a ‘add to cart’ button as the user needs to select tickets and submit the form.


C9

December 7, 2017 at 12:13 am

Hi Tony,
thanks for your reply ๐Ÿ™‚ i will and try this.
and there a one more thing can you please do me a favor,
could you please give me custom event list loop code with add to cart button functionality.

i really appreciate it.


Tony

  • Support Staff

December 7, 2017 at 4:31 am

Sorry, I’m not sure what you are asking for?

Have you added the above function into the loop you using currently?

There’s an example of a simple event list here:

https://gist.github.com/joshfeck/6e33532c37a123bbf532

But it really depends on what you are doing, and where.


C9

December 7, 2017 at 11:55 pm

Yes i added the above function and it is working fine, but it is not showing the loader while i click on “add Event to cart” button.

actually what i am trying to achieve here is the exact same functionality just like Event list Short-code [ESPRESSO_EVENTS] In my custom template with Custom UI.
Here is the code i am using:

// Custom taxonomy
$cat_args = array(
‘taxonomy’ =>’espresso_event_categories’,
‘orderby’ => ‘id’,
‘order’ => ‘ASC’,
);

$custom_terms = get_terms($cat_args);

foreach($custom_terms as $custom_term) :

wp_reset_query();

$args = array(

‘post_type’ => ‘espresso_events’,
‘posts_per_page’ =>15,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘espresso_event_categories’,
‘field’ => ‘slug’,
‘terms’ => $custom_term->slug,
),
),

);

$loop = new WP_Query($args);

if($loop->have_posts()) : while($loop->have_posts()) : $loop->the_post();

Title
Content
Feature Image
Evnet Date
Ticket Name
Ticket Price
Venue Detail

“Add to Cart Button”

endwhile; wp_reset_query(); wp_reset_postdata();
endif;
endforeach;
// END ———————-


Josh

  • Support Staff

December 8, 2017 at 1:21 pm

Hi there,

That does not look like valid PHP code. What you can do instead is use the
[ESPRESSO_EVENTS] shortcode in your template (wrap it in a do_shortcode() function). Then you can set the “Display Ticket Selector” setting to Yes in Event Espresso > Events > Templates under Event List Pages.


C9

December 10, 2017 at 11:23 pm

Josh
Thanks it is working fine ๐Ÿ™‚

how can i add Category/date and search filter with this and pagination too ?


Josh

  • Support Staff

December 12, 2017 at 9:07 am

Pagination will automatically appear if there are more than 10 events. If you want pagination to happen with fewer events, you can add this shortcode parameter:

limit=5

The above example will make it display pagination after displaying 5 events.

Currently there isn’t a search or category date filter feature within the [ESPRESSO_EVENTS] shortcode.


C9

December 21, 2017 at 2:49 am

Josh
Thanks for your reply i i will implement it.

The support post ‘Add to cart on Event Listing Page’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso