Problem/Motivation
The commerce_cart_links module currently provides route handling for adding items to a cart via URL parameters, but it lacks any user-facing UI.
There is no easy or discoverable way for site builders, editors, or integrators to determine how cart links should be constructed for specific product variations and quantities.
At the same time, Drupal Commerce does not offer a built-in way to share a prepared shopping cart between users. This makes workflows such as assisted sales, internal ordering, or editorially curated carts unnecessarily difficult, as users must manually search for and add each product and variation themselves.
This issue proposes adding a minimal UI to commerce_cart_links that both exposes the cart link format and enables a practical “share cart” workflow.
Proposed resolution
Add a basic UI to commerce_cart_links that allows authorized users to generate and copy a shareable link for the current cart.
- Expose a “Share cart” link on the cart page (cart form view).
- The link opens a modal dialog.
- The modal contains a read-only text field with the generated cart link, suitable for copying.
- The feature is only available to users with a dedicated permission.
When opened by another user, the generated link reconstructs the cart using the existing cart link handling logic provided by the module.
Remaining tasks
- Define and add a new permission (e.g. “Generate cart share links”).
- Update the cart form to conditionally expose the “Share cart” link.
- Implement modal dialog with generated cart link.
- Add automated tests for permission checks and link generation.
- Update module documentation to describe the new UI and use cases.
User interface changes
Yes.
- Adds a “Share cart” link to the cart page for authorized users.
- Introduces a modal dialog containing a copyable cart link.
API changes
None anticipated.
Data model changes
None.
Issue fork commerce_cart_links-3563879
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
vmarchukComment #5
zaporylieAdded small feature request.
Comment #6
rszrama commentedCan we define an area handler that adds this to the header / footer of the cart form View? (That will make this more natural in multi-cart scenarios as well.)
Also, do we validate that the order ID a cart link is being requested for is both a cart order and one of the current user's carts? If not, let's add that to the builder's access function.
Comment #7
vmarchukComment #9
vmarchukCommitted!