Discount Codes

how to limit discount code only to 1 order - Discount Codes

how to limit discount code only to 1 order

by loop » Wed Jun 15, 2022 6:44 pm

Hi All
i installed the discount coupon addon and i made a new coupong:
discount: 50
minium order sub: empty
expire: empty
number of use: 1
number of products to apply (it's gray anyway) but empty
applies only to order N: 0 (standard)
applies to "order Sub total"

and i thought, if used 1 time from a customer, the coupon is not valid anymore, but i can made as many orders i want and use the coupon on every order. what i do wrong?

in the admin interface i see "total orders: 4" so it counts the orders made with the coupon, but don't stop from using it...

thank you in advance for the help
loop
VIP Member
VIP Member
Posts: 230
Joined: Thu Mar 25, 2021 12:26 pm
Contact:

Re: how to limit discount code only to 1 order

by loop » Thu Jun 16, 2022 7:18 am

i found out the number_of_use check (in ot_discount.php) is together with the customers_id:

SELECT count(*) AS total, number_of_use
FROM discount_codes
WHERE discount_codes = '%s'
AND customers_id = '%s'
LIMIT 1

that means, if i have a coupon with number of use 1 and NO customers_id selected, everybody can user the discount_code so many times they want. is that the idea?
loop
VIP Member
VIP Member
Posts: 230
Joined: Thu Mar 25, 2021 12:26 pm
Contact:

Re: how to limit discount code only to 1 order

by raiwa » Thu Jun 16, 2022 9:18 am

In Admin: Discount codes:
Number of Use:
For one customer, empty is unlimited

In Admin: Modules: Content: Discount Codes[shopping_cart]:
Show discount input to guests
Do you want to let enter discount codes to guests? False
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Contact:

Re: how to limit discount code only to 1 order

by loop » Thu Jun 16, 2022 8:25 pm

May i ask again, because i'm not sure:
if i want that 1 coupon code is only used once (doesn't matther which customer for me, and doesn't matther if it's guestaccount or not) only important that it can only used once.
the setting is "number of use : 1" and disable guest = false?

i'm not sure about this setting, as i want that guest account can use it....thank you for clarifying...

and one thing: i rewrote the view.php to use jquery to fillout the select boxes, as i have so many products / manufacturers, the page was loading linke 10 seconds until i saw it. now it's very fast. If you are interested in my modification, i can share it with you, maybe you can use it, or take the idea out of it....let me know
Philipp
loop
VIP Member
VIP Member
Posts: 230
Joined: Thu Mar 25, 2021 12:26 pm
Contact:

Re: how to limit discount code only to 1 order

by raiwa » Fri Jun 17, 2022 8:55 am

loop wrote:May i ask again, because i'm not sure:
if i want that 1 coupon code is only used once (doesn't matther which customer for me, and doesn't matther if it's guestaccount or not) only important that it can only used once.
the setting is "number of use : 1" and disable guest = false?
This is not implemented and I can't imagine the case where it is useful. But if you need it, you can modify the code and remove the customer_id check.
and one thing: i rewrote the view.php to use jquery to fillout the select boxes, as i have so many products / manufacturers, the page was loading linke 10 seconds until i saw it. now it's very fast. If you are interested in my modification, i can share it with you, maybe you can use it, or take the idea out of it....let me know
Thank you, but I'm not interested to add jquery scripts. You can post your solution here for other users.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Contact:

Re: how to limit discount code only to 1 order

by loop » Fri Jun 17, 2022 9:07 am

hi raiwa, thank you. maybe i don't get the idea of discount coupon. I use it also for a return product or giftcard, so i give a customer a discount coupon with worth 100 CHF which he can spend, but i don't want that he can spend the voucher 10 times.
is that not the normal use case? or at least a common usecase?
loop
VIP Member
VIP Member
Posts: 230
Joined: Thu Mar 25, 2021 12:26 pm
Contact:

Re: how to limit discount code only to 1 order

by raiwa » Fri Jun 17, 2022 9:35 am

For this case your customer must login so the customer id can be checked. I don't see the sense to allow using the discount for a guest/not logged in customer.
Or you can manually disable the discount code once it has been used.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Contact:

Re: how to limit discount code only to 1 order

by loop » Fri Jun 24, 2022 3:19 pm

Maybe i really don't get the point. I don't want that a "not logged in" customer can use the discount coupon. You are right, that does not make sense.
What i want is, that wenn i write "number of use = 1" that the coupon code can only used once. and at this point i think the only solution is to make numbe of use = 1 and limit to a specific customers_id in the discount coupon admin. But if you forget to limit this ot a specific customers_id, every customer can use the code as many times they want. and i think that's not the idea

so if you forget to limit to customers_id the "number of use" has no meaning to the script
loop
VIP Member
VIP Member
Posts: 230
Joined: Thu Mar 25, 2021 12:26 pm
Contact:

Re: how to limit discount code only to 1 order

by raiwa » Fri Jun 24, 2022 3:27 pm

It has, because one and the same customer can only use it once.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Contact: