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.

Command icon 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

zaporylie created an issue. See original summary.

vmarchuk made their first commit to this issue’s fork.

vmarchuk’s picture

Status: Active » Needs review
zaporylie’s picture

Status: Needs review » Needs work

Added small feature request.

rszrama’s picture

Can 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.

vmarchuk’s picture

Status: Needs work » Needs review

  • vmarchuk committed 29ab2513 on 1.0.x
    Issue #3563879: Add share link on the cart page.
    
vmarchuk’s picture

Status: Needs review » Fixed

Committed!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.