Support

Home Forums Event Espresso Premium Add Cart Modifier

Add Cart Modifier

Posted: November 18, 2016 at 3:17 am

Viewing 8 reply threads


Sebastian Boëthius

November 18, 2016 at 3:17 am

Hi

I was wondering something, in https://github.com/eventespresso/ee-code-snippet-library/blob/master/checkout/bc_add_cart_modifier.php you can add a cart modifier, however this information is not expelled to the AJAX Requests, so the cart isn’t updated when you select the payment method. There are no errors with the requests.

It works when you view the invoice, but it would be great if you could view it while buying the tickets.

This used to work in EE 4.9.0p, but does no long in .21p. Have you changed something, and what can I do to get it to work again?

Thank you!


Josh

  • Support Staff

November 18, 2016 at 7:43 am

The code example from the library still works when I test it on 4.9.21.p. May I ask have you changed something within that snippet?


Sebastian Boëthius

November 21, 2016 at 3:58 am

Hi, thanks for replying.

Well I am trying to adapt it so that it works for other payment methods too. EE_Checkout returns payment_method which I can query. But considering this does not work, I reverted the changes back to the original GitHub code to no avail.

If you want, I can PM you access to the site (it’s behind htpasswd).


Josh

  • Support Staff

November 21, 2016 at 4:52 pm

Hi Sebastian,

That particular snippet was written to work for only the invoice option (and could also work with the other offline payment method like Pay by Check). A developer would need to refactor that code to make the modifier happen with other payment methods.


Sebastian Boëthius

November 21, 2016 at 11:30 pm

Hi Josh

Thanks for your reply. I am in fact a developer, and I nor any of my developer friends can figure out why this snippet has stopped working like it should.

I will again describe the expected scenario and at which point the snippet fails.

Expected
1. Select tickets
1.1. Sum without fees are displayed.
2. Enter details correctly
2.1. Payment options are displayed.
3. Select invoice
3.1. Total is adapted to reflect the newly applied extra fee
3.2, The additional fee is added as a line item to the cart
4. User continues to finalize
4.1. Page with invoice details and the correct new total is displayed.
4.2, Invoice and Receipt reflect added LineItem.

Actual
3.1. and 3.2. do not occur. The user does not see any changes to the total until 4.

Again, I am talking about the BASE CASE, code that is copy pasted verbatim from “your” github repo with the payment method invoice. Adding this snippet as a Plugin or extending functions.php in the could theme makes no difference. I use the theme with my other functional EE Gateway project from where I know that it displays it on change.

Please gives this issue a little more attention

Thanks


Josh

  • Support Staff

November 22, 2016 at 8:00 am

So the code from the snippet library was written to be used with the invoice payment method. This isn’t a case where it stopped working, it never worked with other payments. You can open up a github issue and discuss with one of the developers.

https://github.com/eventespresso/ee-code-snippet-library/issues


tlcu

November 22, 2016 at 2:16 pm

Hi Josh

I’ve opened an issue the repo, as you recommended.

It seems my communication skills might be lacking. I am saying it doesn’t update immediately even if I use it with invoice. Apart from installing everything from scratch, is there something I missed?

* I followed the recommended practice of creating a separate plugin.
* The snippet is copied verbatim
* Tried with TwentySixteen theme (WP Default), no avail
* The payment method is Invoice
* The snippet does its job, but only on the next page and all subsequent pages.

Is there some setting I missed in the EE that would otherwise inhibit this from working? This is a stage environment, so I don’t have the license key in it. Do I need to license key environment for this to work?

Thanks


tlcu

November 22, 2016 at 2:17 pm

Sorry, it is still me, boethius, just logged into the other licensed account…


Josh

  • Support Staff

November 22, 2016 at 2:49 pm

Is there some setting I missed in the EE that would otherwise inhibit this from working?

It’s actually working exactly as coded. You’ve imagined that it’s supposed to adjust the totals on steps 3.1. and 3.2 where “Total is adapted to reflect the newly applied extra fee” & “The additional fee is added as a line item to the cart”. It doesn’t adjust those totals at that exact moment in time. This actually happens after step 4.

This is a stage environment, so I don’t have the license key in it. Do I need to license key environment for this to work?

No, if you take a careful look at the code, you’ll note that the license key does not inhibit or restrict functionality in any way.

Viewing 8 reply threads

The support post ‘Add Cart Modifier’ 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