From 715f4806f530d6b53b42b6cd4f71daac35778c1f Mon Sep 17 00:00:00 2001 From: louwie17 Date: Tue, 13 Apr 2021 16:49:29 -0300 Subject: [PATCH] Redirect to shipping settings page when task is completed (https://github.com/woocommerce/woocommerce-admin/pull/6791) * Redirect to shipping settings page when shipping task after task is completed * Add changelog and testing instructions --- plugins/woocommerce-admin/TESTING-INSTRUCTIONS.md | 12 ++++++++++++ plugins/woocommerce-admin/client/task-list/tasks.js | 12 ++++++++++-- plugins/woocommerce-admin/readme.txt | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/plugins/woocommerce-admin/TESTING-INSTRUCTIONS.md b/plugins/woocommerce-admin/TESTING-INSTRUCTIONS.md index 42d29e907aa..99ff463b48d 100644 --- a/plugins/woocommerce-admin/TESTING-INSTRUCTIONS.md +++ b/plugins/woocommerce-admin/TESTING-INSTRUCTIONS.md @@ -42,6 +42,18 @@ In case the report shows "no data", please reimport historical data by following - Choose payment methods - See no error message +### Set up shipping costs task, redirect to shipping settings after completion. #6791 + +- Create a new store, and finish the Onboarding flow +- Go to **WooCommerce > Home** and select the **Set up shipping costs** task, it should show the standard stepper +- Type some number in the 'Shipping cost' input +- Click the 'Rest of the world' toggle to toggle it on. +- Type some number in the 'Shipping cost' input box under the 'Rest of the world' label +- Finish the set up, but don't need to install the shipping label plugin +- Once on home screen the **Set up shipping costs** task should show as finished +- Click on the task again +- It should now redirect to the shipping settings page. + ## 2.2.0 ### Fixed event tracking for merchant email notes #6616 diff --git a/plugins/woocommerce-admin/client/task-list/tasks.js b/plugins/woocommerce-admin/client/task-list/tasks.js index b0adec83f0f..b8ae7a91874 100644 --- a/plugins/woocommerce-admin/client/task-list/tasks.js +++ b/plugins/woocommerce-admin/client/task-list/tasks.js @@ -26,6 +26,7 @@ import { isWCPaySupported, } from './tasks/payments/wcpay'; import { groupListOfObjectsBy } from '../lib/collections'; +import { getLinkTypeAndHref } from '~/store-management-links'; export function recordTaskViewEvent( taskName, @@ -226,8 +227,15 @@ export function getAllTasks( { title: __( 'Set up shipping costs', 'woocommerce-admin' ), container: , onClick: () => { - onTaskSelect( 'shipping' ); - updateQueryString( { task: 'shipping' } ); + if ( shippingZonesCount > 0 ) { + window.location = getLinkTypeAndHref( { + type: 'wc-settings', + tab: 'shipping', + } ).href; + } else { + onTaskSelect( 'shipping' ); + updateQueryString( { task: 'shipping' } ); + } }, completed: shippingZonesCount > 0, visible: diff --git a/plugins/woocommerce-admin/readme.txt b/plugins/woocommerce-admin/readme.txt index fa9bc32fde9..acc76cfa254 100644 --- a/plugins/woocommerce-admin/readme.txt +++ b/plugins/woocommerce-admin/readme.txt @@ -89,6 +89,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt - Dev: Add support for running php unit tests in PHP 8. #6678 - Fix: Remove no-reply from inbox notification emails #6644 - Performance: Avoid updating customer info synchronously from the front end. #6765 +- Fix: Set up shipping costs task, redirect to shipping settings after completion. #6791 == 2.2.0 3/30/2021 ==