Limit number of downloadable products to 1 each

Open to all! Ask other shopowners for help.
Post Reply
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Limit number of downloadable products to 1 each

Post by 14Steve14 »

I sell lots of downloads and at times customers seem to order more than one of each product even though there is a box on the product page that gives simple instructions like 'Please ensure that all downloadable kits and texture sheets are set to '1' in the 'Quantity' column in your shopping cart.' I then have to mess about and refund customers for the extra files they paid for, even though I don't think I should.

I know some customers are in a hurry to buy something and don't take the time to read what is on the product pages, so I was wondering if there is a simple and easy way to limit the number of downloadable products that can be added to a cart to one of each download. This may not be so simple as several pages could be affected, and there may be a need to remove the product quantity box from the download pages.

Any ideas on the best and easiest way to achieve something.


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Limit number of downloadable products to 1 each

Post by ecartz »

Hook on the checkout page that checks if the order is virtual or mixed content type. If so, iterate through the products to find which are downloadable. If any of those have a quantity greater than one, redirect to the shopping cart page with a message that the quantity is wrong. And/or update the quantity.

It would be possible to only update the quantity, but I would think that you'd want to message the change. So update the quantity and add a messageStack about the change in quantity.

Just messaging would be a little easier to implement but might lead to buyer frustration. And it wouldn't be that much easier.

That would be the easiest to implement. More complicated would be to add a hook prior to the cart update actions that validates the quantity. That would be better in that it would catch problems earlier, but you probably still need the checkout validation just in case.
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: Limit number of downloadable products to 1 each

Post by LeeFoster »

@14Steve14

I created a hook that hides the qty input box on items based on a check box on the admin/product page since a lot of my items are 1 offs.
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: Limit number of downloadable products to 1 each

Post by raiwa »

LeeFoster wrote: Thu Oct 21, 2021 2:25 pm @14Steve14

I created a hook that hides the qty input box on items based on a check box on the admin/product page since a lot of my items are 1 offs.
Then they can still add the same product twice (or more) which will also result in Qty. = 2 (or more)
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
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Limit number of downloadable products to 1 each

Post by 14Steve14 »

LeeFoster wrote: Thu Oct 21, 2021 2:25 pm @14Steve14

I created a hook that hides the qty input box on items based on a check box on the admin/product page since a lot of my items are 1 offs.
How do you then stop them adding further items when they are in the shopping cart page?
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: Limit number of downloadable products to 1 each

Post by LeeFoster »

14Steve14 wrote: Fri Oct 22, 2021 2:32 pm
LeeFoster wrote: Thu Oct 21, 2021 2:25 pm @14Steve14

I created a hook that hides the qty input box on items based on a check box on the admin/product page since a lot of my items are 1 offs.
How do you then stop them adding further items when they are in the shopping cart page?
Not gotten that far with it yet. I had planned to hide it there too but had to switch focus.
Nigel
Contributor
Posts: 114
Joined: Mon Jan 11, 2021 1:39 am
Phoenix Version:
Has thanked: 29 times
Been thanked: 8 times

Re: Limit number of downloadable products to 1 each

Post by Nigel »

Would it be possible to have the items set to one per customer per session ?
Once ordered, the item becomes out of stock for them. The only way to bring it back would be to delete it from the cart.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply