Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when applying coupon code #558

Closed
studiovlijmscherp opened this issue Feb 3, 2022 · 9 comments · Fixed by #559
Closed

Error when applying coupon code #558

studiovlijmscherp opened this issue Feb 3, 2022 · 9 comments · Fixed by #559

Comments

@studiovlijmscherp
Copy link

Bug Description

When applying a coupon code. The server returns an error 500.

Error log:
laravel.log

My cart.antlers.html
cart.antlers.html.zip

Steps to reproduce

Add items to cart. Apply couponcode

Environment

Statamic 3.2.29 Solo
Laravel 8.78.1
PHP 7.4.13
cnj/seotamic 2.0.5
doublethreedigital/duplicator 2.1.0
doublethreedigital/simple-commerce 2.3.64
pecotamic/sitemap 1.2.7

@github-actions
Copy link

github-actions bot commented Feb 3, 2022

Released as part of v2.3.65.

@duncanmcclean
Copy link
Owner

Thanks!

Looks like Statamic doesn't like augmenting fields called value. Since it would be a breaking change to change the field name & the fact it might be fixed at some point in Statamic Core, I've written a workaround.

It should be fixed now for you, in v2.3.65. Have a great evening!

@studiovlijmscherp
Copy link
Author

Updated to latest version. Get redirected to https://domain.com/!/simple-commerce/coupon

with another error:

419
PAGE EXPIRED

@duncanmcclean
Copy link
Owner

Oh, replace the CSRF bit you have with the 'csrf_field' tag.

I forgot to mention that haha. I also noticed you weren't using the tag but you're using a custom form?

@studiovlijmscherp
Copy link
Author

Replace with what?
Using a custom (ajax) form indeed.

@duncanmcclean
Copy link
Owner

Replace it with this: https://statamic.dev/variables/csrf_field

@studiovlijmscherp
Copy link
Author

This doesn't solve the issue unfortunately. Still 419 Expired

<form method="POST" action="/!/simple-commerce/coupon" class="flex flex-1"> {{ csrf_field }} <input type="text" placeholder="Voer je kortingscode in" name="code" class="bg-transparent border border-brand-light p-3 rounded-l text-brand-light text-gray-800 text-lg flex-grow md:flex-grow-0"> <button type="submit" class="bg-brand-regular border border-brand-light hover:bg-brand-light hover:text-black p-3 rounded-r">

@duncanmcclean
Copy link
Owner

That's odd, that fixed it for me when I tried. Are you using static caching?

@studiovlijmscherp
Copy link
Author

Clearing the cache fixed it 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants