Problem/Motivation

As a user editing/adding a store, when adding multiple supported billing countries, I have to hold on Ctrl, scroll, and click on the ones I want to add. This is not very intuitive for a regular user and can get cumbersome when adding more than 2-3 countries. It is also hard to keep track of which countries you had already selected as the list is rather long and the box rather small.

Proposed resolution

Instead of requiring user to Ctrl+click to add new countries, user should be able to search and add using something like this: https://select2.github.io/examples.html

supportedbilling

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

acromel created an issue. See original summary.

rigids’s picture

Assigned: Unassigned » rigids
rigids’s picture

FileSize
83.33 KB
15.85 KB

Added patch

mglaman’s picture

Status: Active » Needs work

There's a few problems here. Specifically that this UX should be solved by the Drupal admin theme.

+++ b/modules/store/commerce_store.libraries.yml
@@ -0,0 +1,13 @@
+    js/contrib/select2.min.js: {}
...
+      css/contrib/select2.min.css: {}

+++ b/modules/store/js/commerce_store.admin.js
@@ -0,0 +1,10 @@
diff --git a/modules/store/js/contrib/select2.min.js b/modules/store/js/contrib/select2.min.js

+++ b/modules/store/js/contrib/select2.min.js
@@ -0,0 +1,3 @@
diff --git a/modules/store/src/Form/StoreForm.php b/modules/store/src/Form/StoreForm.php

The license is not GPL.

https://github.com/select2/select2/blob/master/LICENSE.md

bojanz’s picture

Status: Needs work » Closed (won't fix)

Even if it was GPL, you can't commit code that you don't own into a module.

select2 is for a theme or a distribution, there's nothing Commerce can do here.

rigids’s picture

Do I need to create a PR for this ?

gauravjeet’s picture

Or for better usability and UX, Commerce can support select2. If the library is installed, it will work, else revert back to Drupal element.

mglaman’s picture

RE: #7: that adds additional code to maintain.