Problem/Motivation

When you first install commerce, and you visit the products page to create your first product, your presented with a page that notes you first need to setup your first store. "Products can't be created until a store has been added. Add a new store."

This is great, so you start to create your first store with such details as name address etc., except you can't actually create your first store until you first setup a currency. So its a bit backwards.

Add a Product:

Step 1

Create your Store:

Step 1

Error Message:

Step 1

Proposed resolutions

Option #1: Introduce a setup wizard in the UI when commerce is first installed. Custom configuration of currency and tax rates will be accommodated through the existing UI as they require a more complex approach in regards to setup.

The idea will be to have a "quick" installation method to get your store up and running within a matter of minutes.

Other core commerce modules and contributed modules will be allowed to hook into the step system so they can add their own steps to the wizards guided UI.

Commerce Wizard - Stepper System

Option #2: Introduce the core tour module with a step by step process for initial setup. Could just be a non-intrusive stand alone page, much like a docs page.

Option #3: Replace the messaging/link " Products can't be created until a store has been added. Add a new store." with something along the lines of; "Products can't be created until a store and a default currency have been created. Add at least one supported currency, then add a new store."

Option #4: Place a message with a link below the "Default currency" field, notifying the user they don't have a currencies created, and to create one.

User interface changes

The wizard will use existing drupal 8 core UI patterns for building a progressive step system before creating your store.

API changes

n/a

Data model changes

None.

CommentFileSizeAuthor
#42 improve_the_initial-2878968-42.patch22.81 KBsorabh.v6
#42 improve_the_initial-2878968-42-interdiff.txt2.32 KBsorabh.v6
#42 Peek 2017-09-01 20-00.gif575.75 KBsorabh.v6
#40 improve_the_initial-2878968-40.patch22.19 KBsorabh.v6
#40 improve_the_initial-2878968-40-interdiff.txt3.06 KBsorabh.v6
#39 improve_the_initial-2878968-39.patch23.21 KBsorabh.v6
#37 improve_the_initial-2878968-37.patch24.69 KBsorabh.v6
#37 improve_the_initial-2878968-37-interdiff.patch11.04 KBsorabh.v6
#33 Screenshot from 2017-08-15 19-39-56.png8.31 KBsorabh.v6
#33 Screenshot from 2017-08-15 19-39-36.png15.14 KBsorabh.v6
#32 improve_the_initial-2878968-32-interdiff.txt2.59 KBsorabh.v6
#32 improve_the_initial-2878968-32.patch24.12 KBsorabh.v6
#28 step1-2.png62.39 KBpbrown063
Screen Shot 2017-05-16 at Tuesday, May 16 - 2017 - 8.00.25 PM.png35.98 KBAaronChristian
Screen Shot 2017-05-16 at Tuesday, May 16 - 2017 - 8.01.13 PM.png98.15 KBAaronChristian
Screen Shot 2017-05-16 at Tuesday, May 16 - 2017 - 8.01.34 PM.png53.8 KBAaronChristian
#8 Commerce-Wizard-Screen-1.jpg363.11 KBAaronChristian
#13 Commerce-Wizard-Screen-1.1.jpg303.27 KBAaronChristian
#14 commerce-wizard-module.diff24.73 KBAaronChristian
#16 bartik-admin-ui.jpeg191.32 KBAaronChristian
#16 wizard.gif200.86 KBAaronChristian
#17 commerce-wizard-17.patch25.37 KBAaronChristian
#18 fields-missing-0.png60.62 KBgauravjeet
#18 fields-missing-1.png60.23 KBgauravjeet
#18 fields-missing-2.png73.15 KBgauravjeet
#18 fields-missing-3.png74.65 KBgauravjeet
#18 fields-missing-4.png84.27 KBgauravjeet
#22 commerce_wizard_18.patch4.29 MBrigids
#24 commerce_wizard_18.patch22.3 KBrigids
#26 interdiff-2878968-24-26.txt8.51 KBpbrown063
#26 2878968-26.patch24.33 KBpbrown063
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AaronChristian created an issue. See original summary.

AaronChristian’s picture

Issue summary: View changes
AaronChristian’s picture

Title: UX: Add Product Setup Flow » UX (Admin): Add Product Setup Flow
bojanz’s picture

Title: UX (Admin): Add Product Setup Flow » Improve the initial setup experience
Category: Bug report » Task

We need to implement a setup wizard that creates currencies, stores, tax types, and then product/variation & order types.

AaronChristian’s picture

Sounds good, let me see what I can mock up for a wizard/user flow, and we can get it into dev asap.

bojanz’s picture

Great! Keep in mind that we can choose the currency and tax types based on the customer's country.
That's why the Console command asked you for the store country (a web page can ask for an entire address), then preselected a currency, and when confirmed, created the currency and the store.

For products I'm not sure what makes sense yet, I dislike the fact that we start with a "Default" type that means nothing, would be nicer to ask for a title and for attributes, so that you can say T-Shirt, with Sizes: Small, Medium, large and Colors: Red, Green, Blue, and have the types and attributes created. However, I'm worried people might confuse this with a product creation flow, or that they wouldn't care about this in this stage of the setup.

I would be fine with initially committing a wizard that's about stores/currencies/tax types only, leaving the order/product parts to a followup.

AaronChristian’s picture

FileSize
363.11 KB

Alright so for the first part of the wizard setup this is what I've mocked up so far.

All and any feedback is welcomed.

Wizard

bojanz’s picture

We might need to split 3) into three steps, to make it easier to hide the tax rate part if commerce_tax is disabled or there's no tax type plugin matching the store address.

The general idea will be to make this pluggable, allowing submodules (and even contrib) to add their own steps.

AaronChristian’s picture

Thanks @bojanz, sure I can split that up, I had that initially but was trying to reduce the number of clicks in the wizard.

How do you envision #3 being split up?

1. Confirm Currency
2. Confirm Tax Rates
3. ???

I'll talk to the guys about making the wizard function with other submodules & contrib.

AaronChristian’s picture

Issue summary: View changes
AaronChristian’s picture

Issue summary: View changes
AaronChristian’s picture

FileSize
303.27 KB

Alright,

Here's the latest with the currency & tax steps broken up, also the addition of the cart's block placement step.

In total we have 6 steps, I think if we start adding in too many defaults it may deter some people in using the guide.

Anyways, let me know your thoughts!

Commerce Setup Wizard 1.1

AaronChristian’s picture

FileSize
24.73 KB

First draft, has a new stepper component and all the UI work is done. Just need someone smarter than me to implement the software side of things.

Feedback welcome!

AaronChristian’s picture

Status: Active » Needs review
AaronChristian’s picture

Issue summary: View changes
FileSize
191.32 KB
200.86 KB

Updating IS (added GIF) and adding a Bartik admin screenshot.

Commerce Wizard - Bartik

AaronChristian’s picture

FileSize
25.37 KB

New patch, minor fixes to checkmark image path and link url.

gauravjeet’s picture

Status: Needs review » Needs work
FileSize
60.62 KB
60.23 KB
73.15 KB
74.65 KB
84.27 KB

Very interesting module, and great work!
I reviewed patch #17 on a vanilla install but somehow could not get the store up neither the currency was set up. Probably because there is no textfield/input fields where i can enter the new store's information.

gauravjeet’s picture

Found that the #type used is 'stepper' :

        /*
	 * 1. Store Details
	 */
	$form['commerce_details'] = array(
	  '#type' => 'stepper',
	  '#title' => t('1. Add Store Details'),
//	  '#open' => TRUE,
	  '#button_text' => t('Next, location'),
	);

Is the stepper #type is something provided by default in Form API D8, if not, there is a need to mention a dependency on a contrib module in info.yml file.

heddn’s picture

Category: Task » Feature request

As a PoC, I like the direction. Some small nits here and there, but overall, the look/feel is good. It would help with the PoC if we could surface at least one of the sub-forms to see how that would look in the overall flow.

I'm also going to bikeshed a little on the module name. commerce_setup seems better, or if this is planned to merge into core, then we can stop bikeshedding now.

  1. +++ b/modules/contrib/commerce/modules/wizard/commerce_wizard.info.yml
    @@ -0,0 +1,14 @@
    +
    +
    +
    +
    +
    +
    

    Nit: Whitespace

  2. +++ b/modules/contrib/commerce/modules/wizard/commerce_wizard.links.menu.yml
    @@ -0,0 +1,6 @@
    +  title: 'Wizard Setup'
    

    I see what we are trying to do by calling this 'Wizard Setup', but I feel like 'Commerce Setup' or 'Initial Setup' in the menu is better. Wizard is too technical and tied to implementation. No matter how it is done, this is a setup feature.

    I installed this patch on an already setup Commerce site, so to see Wizard, etc was a little odd feeling.

  3. +++ b/modules/contrib/commerce/modules/wizard/commerce_wizard.links.menu.yml
    @@ -0,0 +1,6 @@
    \ No newline at end of file
    

    Nit: new line missing.

  4. +++ b/modules/contrib/commerce/modules/wizard/commerce_wizard.module
    @@ -0,0 +1,70 @@
    +	$variables = array(
    

    Nit: 2 spaces and short array syntax.

  5. +++ b/modules/contrib/commerce/modules/wizard/commerce_wizard.module
    @@ -0,0 +1,70 @@
    \ No newline at end of file
    

    Nit: missing new line.

  6. +++ b/modules/contrib/commerce/modules/wizard/commerce_wizard.routing.yml
    @@ -0,0 +1,15 @@
    \ No newline at end of file
    

    Nit: missing new line.

  7. +++ b/modules/contrib/commerce/modules/wizard/css/commerce_wizard.component.css
    @@ -0,0 +1,69 @@
    \ No newline at end of file
    

    Nit: missing new line.

  8. +++ b/modules/contrib/commerce/modules/wizard/css/commerce_wizard.layout.css
    @@ -0,0 +1,10 @@
    \ No newline at end of file
    
    +++ b/modules/contrib/commerce/modules/wizard/images/check.svg
    @@ -0,0 +1 @@
    \ No newline at end of file
    
    +++ b/modules/contrib/commerce/modules/wizard/src/Controller/WizardController.php
    @@ -0,0 +1,23 @@
    \ No newline at end of file
    
    +++ b/modules/contrib/commerce/modules/wizard/src/Element/Stepper.php
    @@ -0,0 +1,81 @@
    \ No newline at end of file
    
    +++ b/modules/contrib/commerce/modules/wizard/src/Form/WizardForm.php
    @@ -0,0 +1,131 @@
    \ No newline at end of file
    
    +++ b/modules/contrib/commerce/modules/wizard/templates/commerce-wizard.html.twig
    @@ -0,0 +1,52 @@
    \ No newline at end of file
    

    Nit: missing new line.

  9. +++ b/modules/contrib/commerce/modules/wizard/js/commerce_wizard.js
    @@ -0,0 +1,126 @@
    +            // enable/disabled the main form submit
    +            // depending on if were on the last step or not
    ...
    +            // close the current step and set it to complete state
    ...
    +            // open the next step, and perform the ajax submit in the step we're closing
    

    Nit: 80 characters for comments and begin with a capital letter and end with a period.

  10. +++ b/modules/contrib/commerce/modules/wizard/src/Controller/WizardController.php
    @@ -0,0 +1,23 @@
    +	public function content() {
    

    Nit: 2 spaces instead of 4.

  11. +++ b/modules/contrib/commerce/modules/wizard/src/Controller/WizardController.php
    @@ -0,0 +1,23 @@
    +			'#title' => $this->t('Commerce: Quick Install'),
    +			'#intro_title' => $this->t('Hey! It looks like this is your first time using drupal commerce.'),
    

    This shows up, even after commerce is fully installed. Maybe 'Hey! It looks like you want help setting up and configuring Drupal Commerce!' Or something better.

  12. +++ b/modules/contrib/commerce/modules/wizard/src/Controller/WizardController.php
    @@ -0,0 +1,23 @@
    +			'#intro_text' => $this->t('Lets take a few minutes to get your store setup and configured, or <a href="@url">skip the setup wizard</a> if you plan to configure your store manually.', array('@url' => '#')),
    

    What is envisioned as the action if someone selects 'skip'? Would a config option be switched so that the menu option goes away or would the form list a success message saying everything is now setup?

  13. +++ b/modules/contrib/commerce/modules/wizard/src/Element/Stepper.php
    @@ -0,0 +1,81 @@
    +        // The .js-form-wrapper class is required for #states to treat details like
    

    Nit: 80 characters for comments.

  14. +++ b/modules/contrib/commerce/modules/wizard/src/Form/WizardForm.php
    @@ -0,0 +1,131 @@
    +	/**
    +	 * {@inheritdoc}
    +	 */
    +	public function getFormId() {
    

    Nit: 2 spaces instead of 4, and on through this class.

  15. +++ b/modules/contrib/commerce/modules/wizard/src/Form/WizardForm.php
    @@ -0,0 +1,131 @@
    +//			'#open' => TRUE,
    

    Nit: remove commented code.

  16. +++ b/modules/contrib/commerce/modules/wizard/src/Form/WizardForm.php
    @@ -0,0 +1,131 @@
    +			'#button_text' => t('Next, location'),
    

    This is jarring to see 'Next, location'. I thought I was setting up a store. What's with Location showing up. It might be less of an issue once the actual store details surface. However, we do need to consider how this will look when someone has already done partial setup where maybe the store and location are setup, but the currency is done at a later date.

    Ah, I see later these buttons are changed to a 'Confirm'. I think I like that better.

    Another note, if I re-edit the store, it resets status on /all/ of the later options. Actually, if I do that with any of the options, it resets the status for all up to that point. Forcing me to re-walk through the entire wizard. I didn't necessarily expect/want that.

  17. +++ b/modules/contrib/commerce/modules/wizard/templates/commerce-wizard.html.twig
    @@ -0,0 +1,52 @@
    +    {% trans %}
    +    <ol>
    +        <li>
    +            <strong>Add store details</strong><br/>
    +            Enter a name for your store, and an email to receive notifications from it.
    +        </li>
    +        <li>
    +            <strong>Enter the stores location</strong><br/>
    +            Add the store physical address, or choose one closest to its' location.
    +        </li>
    +        <li>
    +            <strong>Confirm the stores primary currency </strong><br/>
    +            We’ll try to determine your stores currency based on the location you've entered.
    +        </li>
    +        <li>
    +            <strong>Confirm the stores primary tax rate(s)</strong><br/>
    +            We’ll try to determine your stores tax rate(s) based on the location you’ve entered.
    +        </li>
    +        <li>
    +            <strong>Place your cart block in a region</strong><br/>
    +            Next, choose where your customers will see the number of items they've added to their cart on your site.
    +        </li>
    +        <li>
    +            <strong>Add a payment processor</strong><br/>
    +            Start accepting payments by choosing from over 30 supported payment processors.
    +        </li>
    +    </ol>
    +
    +    <div class="form-actions">
    +        <a href="wizard/install" class="button button--primary">Begin Setup</a>
    +        <a href="#" class="button button--danger">No, thanks</a>
    +    </div>
    +
    +    {% endtrans %}
    

    This much to translate with all that markup is going to be hard. Shorter strings are better.

bojanz’s picture

The wizard will live in the commerce base module, so we don't need to bikeshed the patch module name.

rigids’s picture

FileSize
4.29 MB

Created a patch for #20

rigids’s picture

rigids’s picture

FileSize
22.3 KB

Re-rolled patch

heddn’s picture

re #24: can I see an interdiff? And usually when something is ready to be looked at again, we change the status to Needs Review. Is this ready for review or are you still working on things.

pbrown063’s picture

Update to .patch file with changes:
- Added fields to steps 1 and 2 of the setup

Next tasks:
- Pull those fields from the /store/add form instead of having them free form
- Add functionality to create a store entity when the 'Create Store'
button is clicked in the wizard

heddn’s picture

Can we see some updated screenshots of step 1/2?

pbrown063’s picture

FileSize
62.39 KB

Updated Step 1 and 2 screen shots

heddn’s picture

Generally speaking, I like this. I don't like the wording of the buttons. Maybe 'Proceed to Next Step'.

AaronChristian’s picture

I'll agree with @heddn here, we can probably just make it a "catch-all" for verbiage on the button, less configuration is better.

sorabh.v6’s picture

Assigned: Unassigned » sorabh.v6
sorabh.v6’s picture

Status: Needs work » Needs review
FileSize
24.12 KB
2.59 KB

Previous patch was failing. So fixed it, and changed the labels of stepper buttons as per #29. Create Store button is disabled, how can I activate it when all steppers are done.

sorabh.v6’s picture

Hi, I suggest changing country field with select-list, like we have in store add form.

Also, I think we should have user reference field for Owner instead of a plain text-field.

heddn’s picture

Status: Needs review » Needs work
  1. +++ a/README.md
    @@ -0,0 +1,2 @@
    +# D-comm_setup_wiz
    

    Stray comment.

  2. +++ b/modules/contrib/commerce/modules/wizard/src/Form/WizardForm.php
    @@ -31,7 +31,7 @@
    +            '#button_text' => t('Proceed to Next Step'),
    

    I think I see a trend towards lower case for all but the first word for buttons in the wild. So, "Proceed to the next step" is preferred.

  3. +++ b/modules/contrib/commerce/modules/wizard/src/Form/WizardForm.php
    @@ -119,7 +119,7 @@
                 '#markup' => t('<p>As a default, the cart block consists of; the number of items added to the users cart, their total, and a link to proceed to their cart for review & checkout.</p>
    -											<p>Select a region on your site where you’d like customers to view this block.</p>'),
    +<p>Select a region on your site where you’d like customers to view this block.</p>'),
    

    This much markup interspersed with translatable text is not really good for i18n. Let's just do the t() on the wording and concatenate the p tags, etc.

SilverBallz’s picture

.

heddn’s picture

So, after we add the create forms to the wizard, we need to make some decisions. I think there are two possible paths. I prefer one over the other. We need to decide what to do when a site is already configured, or partially configured. No need to add store details and location if we've already added those.

Path #1:
If something exists, state it already exists and provide a link to the admin page where the thing can be edited. By providing a link, we can direct folks to the listing page for stores and blocks. And we don't have to decide which is the "primary" block or payment gateway.

Path #2:
Arbitrarily or deterministicly elect a "primary" store of payment gateway and display it in the edit form; instead of the normal create store form, payment gateway form, etc.

I prefer option #1. But I've listed #2 for completeness sake.

sorabh.v6’s picture

Status: Needs work » Needs review
FileSize
11.04 KB
24.69 KB

@heddn I have created SubformState for the stepper in the form. I have also made changes suggested above. Request you to review.

Thanks

sorabh.v6’s picture

Assigned: sorabh.v6 » Unassigned
sorabh.v6’s picture

New patch uploading.

This patch contains code for split 'store add' form for 'store details' and 'store location'.

Now, need to get location details upon click of stepper button so that currency suggestion can be made based on store location. Need some guidance on how I can get form details upon clicking stepper button.

Thanks

sorabh.v6’s picture

Uploading correct patch and interdiff.

heddn’s picture

Status: Needs review » Needs work

We'll probably need to do the location => currency via AJAX. See https://api.drupal.org/api/drupal/core%21core.api.php/group/ajax/8.2.x.

sorabh.v6’s picture

Status: Needs work » Needs review
FileSize
575.75 KB
2.32 KB
22.81 KB

I applied ajax to location submit button and created a callback function. But control doesn't enter the callback function, and throws error in the below screenshot.

Please suggest a solution.

a.dmitriiev’s picture

I suggest using InlineFormManager for this since it is in commerce 2.13 already. Also I think it should not be a separate module, because the core commerce module is enabled anyway, this should be there. It is only needed to restrict the access to wizard after it was configured.

FiNeX’s picture

Hi, the setup wizard looks a very good idea. Has it be abandoned?

dwkitchen’s picture

Project: Commerce Core » Commerce Store Wizard
Version: 8.x-2.x-dev »
Component: User experience » Code