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

Unable to reedem coupon #276

Closed
2 tasks
sebabal opened this issue Aug 12, 2020 · 5 comments
Closed
2 tasks

Unable to reedem coupon #276

sebabal opened this issue Aug 12, 2020 · 5 comments
Labels

Comments

@sebabal
Copy link
Contributor

sebabal commented Aug 12, 2020

Hey guys I am unable to redeem coupons I have this on the front end:

{{ if {sc:coupon:has} === true }}
	{{ sc:coupon }}
	<div class="flex flex-col mb-2 py-2">
		<h3 class="font-bold text-lg mb-2 text-gray-800">Coupon</h3>

		<div>
			<p class="inline-block"><strong class="font-bold uppercase">{{ slug }}</strong> has been applied
				to your cart.</p>
			{{ sc:coupon:remove class='inline-block' }}
			<button class="text-red-700 font-medium focus:outline-none ml-1" type="submit">Remove</button>
			{{ /sc:coupon:remove }}
		</div>
	</div>
	{{ /sc:coupon }}
	{{ else }}
	{{ sc:coupon:redeem id='redeemCoupon' }}
	<div class="flex flex-col mb-2 py-2">
		<h3 class="font-bold text-lg mb-2 text-gray-800">Redeem a Coupon</h3>

		<div class="flex flex-row items-start w-full">
			<input class="md:w-2/3 border rounded p-2 mb-2 text-gray-600 focus:text-gray-800 outline-none mr-2"
				type="text" name="code" placeholder="Coupon Code" value="{{ old:code }}" required>
			<div x-data="{ loading: false }" class="md:w-1/3 flex flex-row items-center">
				<button x-show="loading === true"
					class="bg-primary hover:bg-tertiary py-2 px-6 uppercase text-white font-bold w-full h-full flex flex-row items-center justify-center"
					type="button">
					<i class="fal fa-spinner-third fa-spin mr-2"></i> Processing
				</button>

				<button x-show="loading === false"
					class="bg-primary hover:bg-tertiary py-2 px-6 uppercase text-white font-bold w-full h-full"
					type="button"
					x-on:click.prevent="loading = true; document.getElementById('redeemCoupon').submit()">
					Redeem
				</button>
			</div>
		</div>
	</div>
	{{ /sc:coupon:redeem }}
{{ /if }}

I looked at the response and I am not getting anything back so I am not sure if it is being processed correctly. Have you experienced anything similar?

Environment information

Simple Commerce version: v2.0

Statamic version: 3.0.0-beta.43

PHP version: 7.4.3

Operating System:

  • Linux

Browser:

  • Chrome
@sebabal sebabal added the bug label Aug 12, 2020
@duncanmcclean
Copy link
Owner

Thanks for reporting!

Could you share the file of the coupon you're trying to redeem?

@sebabal
Copy link
Contributor Author

sebabal commented Aug 13, 2020

Duncan, here are the coupon and the blueprint

sherpa.txt
coupon.txt

@duncanmcclean
Copy link
Owner

They seem okay. What are you trying to use as the coupon code?

@sebabal
Copy link
Contributor Author

sebabal commented Aug 13, 2020

The coupon code I am trying to redeem is called "sherpa". Here are some screenshots, the post is going through, although I am not getting a response but perhaps that is by design and there is no response....

redeemui
post
data
response

@duncanmcclean
Copy link
Owner

Alright, looks like it was a little validation error in Simple Commerce. It was checking for a coupon field, where the rest of the code and the starter kit examples used the code field instead.

I'll push out a fix for this in the next release. Thanks for reporting!

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

No branches or pull requests

2 participants