This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42735bf
commit 0314cea
Showing
4 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/Domain/Services/OnboardingTasks/ReviewCheckoutTask.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
namespace Automattic\WooCommerce\Blocks\Domain\Services\OnboardingTasks; | ||
|
||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task; | ||
|
||
/** | ||
* Review the cart/checkout Task | ||
*/ | ||
class ReviewCheckoutTask extends Task { | ||
/** | ||
* ID. | ||
* | ||
* @return string | ||
*/ | ||
public function get_id() { | ||
return 'review-checkout-experience'; | ||
} | ||
|
||
/** | ||
* Title. | ||
* | ||
* @return string | ||
*/ | ||
public function get_title() { | ||
return __( 'Review the shopper checkout experience', 'woo-gutenberg-products-block' ); | ||
} | ||
|
||
/** | ||
* Content. | ||
* | ||
* @return string | ||
*/ | ||
public function get_content() { | ||
return __( 'Make sure cart and checkout flows are configured correctly for your shoppers.', 'woo-gutenberg-products-block' ); | ||
} | ||
|
||
/** | ||
* Time. | ||
* | ||
* @return string | ||
*/ | ||
public function get_time() { | ||
return ''; | ||
} | ||
|
||
/** | ||
* Check if a task is dismissable. | ||
* | ||
* @return bool | ||
*/ | ||
public function is_dismissable() { | ||
return false; | ||
} | ||
|
||
/** | ||
* Task completion. | ||
* | ||
* @return bool | ||
*/ | ||
public function is_complete() { | ||
return false; | ||
} | ||
|
||
/** | ||
* Task visibility. | ||
* | ||
* @return bool | ||
*/ | ||
public function can_view() { | ||
$checkout_page_id = wc_get_page_id( 'checkout' ); | ||
|
||
return $checkout_page_id > 0; | ||
} | ||
|
||
/** | ||
* Action URL. | ||
* | ||
* @return string | ||
*/ | ||
public function get_action_url() { | ||
$checkout_page_id = wc_get_page_id( 'checkout' ); | ||
|
||
return admin_url( 'site-editor.php?postType=page&postId=' . $checkout_page_id ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Automattic\WooCommerce\Blocks\Domain\Services\OnboardingTasks; | ||
|
||
use Automattic\WooCommerce\Blocks\Domain\Services\OnboardingTasks\ReviewCheckoutTask; | ||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskLists; | ||
|
||
/** | ||
* Onboarding Tasks Controller | ||
*/ | ||
class TasksController { | ||
|
||
/** | ||
* Init tasks. | ||
*/ | ||
public function init() { | ||
add_action( 'init', [ $this, 'register_tasks' ] ); | ||
} | ||
|
||
/** | ||
* Register tasks. | ||
*/ | ||
public function register_tasks() { | ||
TaskLists::add_task( | ||
'extended', | ||
new ReviewCheckoutTask() | ||
); | ||
} | ||
} |