woocommerce
/
src
/
Admin
/
Features
/
OnboardingTasks
/
Tasks
/
ExperimentalShippingRecommendation.php
AdditionalPayments.php
1 year ago
Appearance.php
2 years ago
CustomizeStore.php
5 months ago
ExperimentalShippingRecommendation.php
5 months ago
ExtendStore.php
1 year ago
GetMobileApp.php
3 years ago
LaunchYourStore.php
2 years ago
Marketing.php
7 months ago
Payments.php
10 months ago
Products.php
1 month ago
ReviewShippingOptions.php
3 years ago
Shipping.php
3 months ago
StoreCreation.php
4 years ago
StoreDetails.php
3 years ago
Tax.php
1 year ago
TourInAppMarketplace.php
2 years ago
WooCommercePayments.php
5 months ago
ExperimentalShippingRecommendation.php
98 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks; |
| 4 | |
| 5 | use Automattic\Jetpack\Connection\Manager; |
| 6 | use Automattic\WooCommerce\Admin\Features\Features; |
| 7 | use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task; |
| 8 | use Automattic\WooCommerce\Admin\PluginsHelper; |
| 9 | use Automattic\WooCommerce\Internal\Jetpack\JetpackConnection; |
| 10 | |
| 11 | /** |
| 12 | * Shipping Task |
| 13 | */ |
| 14 | class ExperimentalShippingRecommendation extends Task { |
| 15 | /** |
| 16 | * ID. |
| 17 | * |
| 18 | * @return string |
| 19 | */ |
| 20 | public function get_id() { |
| 21 | return 'shipping-recommendation'; |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Title. |
| 26 | * |
| 27 | * @return string |
| 28 | */ |
| 29 | public function get_title() { |
| 30 | return __( 'Get your products shipped', 'woocommerce' ); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Content. |
| 35 | * |
| 36 | * @return string |
| 37 | */ |
| 38 | public function get_content() { |
| 39 | return ''; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Time. |
| 44 | * |
| 45 | * @return string |
| 46 | */ |
| 47 | public function get_time() { |
| 48 | return ''; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Task completion. |
| 53 | * |
| 54 | * @return bool |
| 55 | */ |
| 56 | public function is_complete() { |
| 57 | return self::has_plugins_active() && self::has_jetpack_connected(); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Task visibility. |
| 62 | * |
| 63 | * @return bool |
| 64 | */ |
| 65 | public function can_view() { |
| 66 | return Features::is_enabled( 'shipping-smart-defaults' ); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Action URL. |
| 71 | * |
| 72 | * @return string |
| 73 | */ |
| 74 | public function get_action_url() { |
| 75 | return ''; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Check if the store has any shipping zones. |
| 80 | * |
| 81 | * @return bool |
| 82 | */ |
| 83 | public static function has_plugins_active() { |
| 84 | return PluginsHelper::is_plugin_active( 'woocommerce-shipping' ); |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Check if the Jetpack is connected. |
| 89 | * |
| 90 | * @return bool |
| 91 | */ |
| 92 | public static function has_jetpack_connected() { |
| 93 | $jetpack_connection_manager = JetpackConnection::get_manager(); |
| 94 | |
| 95 | return $jetpack_connection_manager->is_connected() && $jetpack_connection_manager->has_connected_owner(); |
| 96 | } |
| 97 | } |
| 98 |