Prevent duplicate licenses

Created on 28 August 2015, about 10 years ago
Updated 19 August 2025, about 2 months ago

Although some sites might need to allow a user to purchase multiple copies of the same license (e.g. to increase time limit), others will not need this. It would be great if this module had a setting to prevent multiple copies being bought. This should be a setting per product type where this module enabled.

Currently the user experience is confusing. If the license is added to cart a second time, the two items will not combine in the cart, so in a large order it would be easy to pay twice by mistake.

This issue arose out of discussions in ✨ Commerce license does not combine line items and quantity can't be changed Closed: outdated .

Code is likely needed in hook_commerce_cart_add_to_cart_form_alter and similar to this post.

  1. If same product is already in cart, disable submit button and change text to t('In cart').
  2. If same product is already licensed (commerce_license_exists?), disable submit button and change text to t('Licensed').

In each case, the text to display is configurable by a variable setting, and if text is blank, the button is hidden.

✨ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom adamps

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024