Support

Home Forums Multiple Event Registration Add-on Add to cart works but number of tickets remains 0

Add to cart works but number of tickets remains 0

Posted: March 18, 2014 at 2:31 am


Anonymous

March 18, 2014 at 2:31 am

Clicking Add to cart works fine; viewing the shopping cart afterwards does show the event. However, the requested number of tickets is still 0. Visitor has to increase this manually to 1 (the max number of tickets he can buy), from there it works allright again. If visitor leaves it at 0, he has to removing it from the shopping cart to be able to proceed.

I would like ‘Add to shopping cart’ to put 1 (not 0) tickets in the shopping cart. Even better would be if user was completely unable to change number of tickets: buy either one, or remove from cart.

How can I do that? Thanks!


Dean

March 18, 2014 at 4:03 am

Hi,

You could do this with a little bit of jQuery.

Here is a slightly modified version of some code Josh came up with, that can be added to the shopping_cart.php template

<script>jQuery(document).ready(function(){
    jQuery(".price_id").val(1);
    jQuery('#event_espresso_refresh_total').trigger('click');
    jQuery(".price_id option[value='0']").remove();
});
</script>


Anonymous

March 18, 2014 at 8:42 am

Thank you for your quick response!

I added ?> at the end of shopping_cart.php, added your code and it worked great! Thanks!

The following sentence, “You can register a maximum of %d attendees for this event.”, now does not make much sense anymore. Can you help me get rid of that next table row? I searched the code for <td colspan=”3″> and reg-allowed-limit but could not find it. Thank you!


Lorenzo Orlando Caum

  • Support Staff

March 18, 2014 at 9:31 am

Hi Anouk,

That phrase has a CSS class associated with it. This works for me on a test site:

.reg-allowed-limit {display:none;}

I recommend adding it to your site using a plugin like My Custom CSS. This will ensure that your styling edit is not lost on a plugin or theme update.


Lorenzo


Anonymous

March 18, 2014 at 2:20 pm

Hi Lorenzo,

Thanks for your elegant solution, this works perfectly for me. The theme I use has a box for custom css, so I put it there and it will survive plugin updates.

How about the changes I made to shopping_cart.php, will they get lost when the plugin gets updated? Will saving those files in a child theme folder work?


Tony

  • Support Staff

March 19, 2014 at 4:53 am

Hi Anouk,

If you copy that modified shopping_cart.php file to wp-content/uploads/espresso/templates/ Event Espresso will use that file and it will then be ‘update-safe’


Anonymous

March 19, 2014 at 5:43 am

Ok, cool. Thanks!


Tony

  • Support Staff

March 19, 2014 at 6:02 am

No Problem 🙂

The support post ‘Add to cart works but number of tickets remains 0’ 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