-
Notifications
You must be signed in to change notification settings - Fork 143
New notification: Don't forget to test your checkout #4805
Conversation
| // Make sure a product was published or imported. | ||
| $product_added = get_option( | ||
| self::PRODUCT_ADDED_OPTION_NAME | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than hook into the importer and post status transition hooks, what do you think about checking the status of the products step in the task list instead? Seems like this could be simpler if we were just checking for the products and payments steps to be complete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really like this idea Jeff!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jeffstieler, thanks for your review.
Diving a little bit into that part of the code, I realized that the check (that later will be used to set the products state in the task list) is calculated in the API side in the method check_task_completion and it's asking for products with state published or draft. From what I understand, this could be a problem since we need to show the note after the product publication, but the list item could be set as completed without a published product.
Please correct me if I misunderstood your suggestion or I'm forgetting something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.. looks like that wasn't the original intention and was updated later: #2667 (comment)
Perhaps we should look at only marking the step complete if there are published products? cc: @timmyc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I concur there, but cc @pmcpinto to verify for sure. The product step right now will get marked as done even when a product is in the draft state. But I definitely like tying this note to that step being completed because it will eliminate this note possibly being shown on an established site.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @jeffstieler and @timmyc, I removed the verification of the products with state draft in the commit 14d5df2 and it looks like everything is working well.
I was thinking about when this note should be shown. If the user doesn't set a payment method when the Add my products task list is completed, the note won't be shown. Also, we don't save a timestamp when we update the products' task list, which means that we don't know when we completed this task list item.
The note reminds the user Don't forget to test your checkout, so it looks like we should show the note if the user adds their first product and has the other conditions we need. For instance, a user could have everything set but no products for a month. Should we show the note if they suddenly add a product?
If the answer is yes, I think that we should verify the published date of the first product, and if it's within the last 30 (or 15, or 10) minutes and fulfills the other conditions, I would trigger the note.
Does this make sense?
| $note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); | ||
| $note->set_name( self::NOTE_NAME ); | ||
| $note->set_source( 'woocommerce-admin' ); | ||
| $note->add_action( 'test-checkout', __( 'Test checkout', 'woocommerce-admin' ), site_url() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use wc_get_page_permalink( 'shop' ) here it will direct them to the shop, and automatically falls back to the site url.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! I replaced the method in the commit 58c866a
Can we use the store creation date to avoid show this to existing stores? We have a good amount of new users that add a product without going through the task list step. Is this step being marked as completed even if they add a product without passing by this task? |
|
Hi @pmcpinto,
Looking at the notification message I was thinking that maybe we could do the verification using the date of the first published product to show this note.
Yes, we mark the step as complete even if the user adds a product without passing by this task. |
Yep, sounds good to me. Thanks for the suggestion! |
|
According to Pedro's answer I added the time validation (30 minutes) to the first published product in the commit 04faa14. |
| } | ||
|
|
||
| $oldest_product_timestamp = $products[0]->get_date_created()->getTimestamp(); | ||
| $half_hour_in_seconds = 0.5 * HOUR_IN_SECONDS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: 30 * MINUTE_IN_SECONDS would avoid float and int comparison.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! I modified it in the commit 8d31053
| return; | ||
| } | ||
|
|
||
| $content = __( 'Make sure that your checkout is working properly before your launch your store. Go through your checkout process in its entirety: from adding a product to your cart, choosing a shipping location, and making a payment.', 'woocommerce-admin' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "before your launch your store" -> "before you launch your store".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! I changed it in the commit 85a0054
jeffstieler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tested well - just need to fix a typo and make some minor code tweaks. Pre-approving.
This commit adds a note to test the checkout process # Conflicts: # src/Events.php # src/FeaturePlugin.php
…tion" This commit modifies the code to not set the products task list item as done when they have state draft.
This commit adds a product published date control to the note
|
As all the fixes have been addressed I'm going to merge this PR. |
Fixes #4213
This PR adds a note to remind the user to test the checkout process.
This note should be triggered when the user has a payment method AND adds or imports products.
Segmentation:
New users with
setup_client:falseonwcadmin_storeprofiler_store_details_continueTiming:
"After triggering:
wcadmin_product_add_publishorwcadmin_product_import_completeAND
task_name: paymentsonwcadmin_tasklist_task_completedCadence: Once
Screenshots
Detailed test instructions:
/wp-admin/tools.php?page=crontrol_admin_manage_pageand presswc_admin_daily.wc_admin_note_test_checkout_product_addedfrom the database with a sentence like this:Import products.
At the end of the process, the note should be visible.
Verify the call to action button in the note opens the store frontend in a new tab
Changelog Note:
Dev: New notification: Don't forget to test your checkout