Posted: October 11, 2017 at 6:00 am
|
For each of my events I want people to be able to buy some products (sunglasses and wrist bands). I’ve used the snippet from here – https://github.com/eventespresso/ee-code-snippet-library/blob/master/checkout/bc_ee_add_product_surcharge.php but it’s not quite working, it only shows the selection for the second product and nothing for the first. I’m pretty sure I have the second product in the wrong spot but I don’t know how to fix it. This is the bit that I think I have wrong:
|
Hi there, It looks like you’re missing a closing bracket and you need to start a second array item for the second product. For example in your code where you have this:
That should be changed to:
|
|
|
I’ve added that into the code but it’s still not picking up the second lot of goods. I only get the first one. |
Can you post the entirety of the code into a pastebin or a gist, then link here? The code you’ve posted here may not be the only part that needs fixing if you fixed that one issue. |
|
|
I have PasteBinned it (I hope this works!!!) This is the entire snippet that I have: |
Hi Debbie, Try this snippet: |
|
|
I copied exactly what you had there and tried it – nothing happened when I selected the products. I tried changing the product_question_id and product_qty_question_id to the IDs I had created and when I did that I got the error below (I hope it shows) or the link https://drive.google.com/file/d/0B6uqrA0HpL6qWWtweVBZX3d6eFk/view?usp=sharing |
My apologies, I change the ID’s to suit my site whilst testing, I should have changed those back in the snippet for you. I’ve created a gist so I can edit the code on the fly, try this version: https://gist.github.com/Pebblo/51c4284d2dbedb7c0e1daff0c562f1dc With the above error you posted, there will be an error being thrown during the request, do you have access to the server error logs? If so, see if there are any errors from the above code shown there. |
|
The support post ‘Product Surcharge snippet’ 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.