diff --git a/includes/class-wc-calypso-bridge-addons-screen.php b/includes/class-wc-calypso-bridge-addons-screen.php index 68e824df..5cd97074 100644 --- a/includes/class-wc-calypso-bridge-addons-screen.php +++ b/includes/class-wc-calypso-bridge-addons-screen.php @@ -68,8 +68,12 @@ public static function output() { return; } - if ( isset( $_GET['install-addon'] ) && 'woocommerce-services' === $_GET['install-addon'] ) { // WPCS: CSRF ok. - self::install_woocommerce_services_addon(); + if ( isset( $_GET['install-addon'] ) && 'woocommerce-tax' === $_GET['install-addon'] ) { // WPCS: CSRF ok. + self::install_woo_tax_addon(); + } + + if ( isset( $_GET['install-addon'] ) && 'woocommerce-shipping' === $_GET['install-addon'] ) { // WPCS: CSRF ok. + self::install_woo_shipping_addon(); } $sections = self::get_sections(); @@ -103,4 +107,44 @@ public static function output() { */ include_once WC_ABSPATH . 'includes/admin/views/html-admin-page-addons.php'; } + + /** + * Install Woo Tax from Extensions screens. + * + * @since x.x.x + */ + public static function install_woo_tax_addon() { + check_admin_referer( 'install-addon_woocommerce-tax' ); + + $services_plugin_id = 'woocommerce-tax'; + $services_plugin = array( + 'name' => __( 'Woo Tax', 'woocommerce' ), + 'repo-slug' => 'woocommerce-tax', + ); + + WC_Install::background_installer( $services_plugin_id, $services_plugin ); + + wp_safe_redirect( remove_query_arg( array( 'install-addon', '_wpnonce' ) ) ); + exit; + } + + /** + * Install Woo Shipping from Extensions screens. + * + * @since x.x.x + */ + public static function install_woo_shipping_addon() { + check_admin_referer( 'install-addon_woocommerce-shipping' ); + + $services_plugin_id = 'woocommerce-shipping'; + $services_plugin = array( + 'name' => __( 'Woo Shipping', 'woocommerce' ), + 'repo-slug' => 'woocommerce-shipping', + ); + + WC_Install::background_installer( $services_plugin_id, $services_plugin ); + + wp_safe_redirect( remove_query_arg( array( 'install-addon', '_wpnonce' ) ) ); + exit; + } } diff --git a/includes/class-wc-calypso-bridge-plugins.php b/includes/class-wc-calypso-bridge-plugins.php index 86a4a22e..5d0c59b0 100644 --- a/includes/class-wc-calypso-bridge-plugins.php +++ b/includes/class-wc-calypso-bridge-plugins.php @@ -22,7 +22,8 @@ class WC_Calypso_Bridge_Plugins { const WPCOM_ECOMMERCE_PLUGINS = array( 'woocommerce/woocommerce.php', 'facebook-for-woocommerce/facebook-for-woocommerce.php', - 'woocommerce-services/woocommerce-services.php', + 'woocommerce-tax/woocommerce-tax.php', + 'woocommerce-shipping/woocommerce-shipping.php', 'woocommerce-product-addons/woocommerce-product-addons.php', 'woocommerce-product-bundles/woocommerce-product-bundles.php', 'woocommerce-gift-cards/woocommerce-gift-cards.php', diff --git a/includes/notes/data/class-wc-calypso-bridge-admin-note-data-store.php b/includes/notes/data/class-wc-calypso-bridge-admin-note-data-store.php index d6f527e3..ac153dcb 100644 --- a/includes/notes/data/class-wc-calypso-bridge-admin-note-data-store.php +++ b/includes/notes/data/class-wc-calypso-bridge-admin-note-data-store.php @@ -164,6 +164,8 @@ protected function get_suppress_list() { 'wc-admin-selling-online-courses', // suppress for now, to be revisited. // Extensions. 'woocommerce-services', + 'woocommerce-tax', + 'woocommerce-shipping', 'gla-invalid-php-version', 'gla-64-bit', 'gla-wc-admin', diff --git a/src/free-trial/tax/index.tsx b/src/free-trial/tax/index.tsx index ccb0eb77..11ad3597 100644 --- a/src/free-trial/tax/index.tsx +++ b/src/free-trial/tax/index.tsx @@ -112,7 +112,7 @@ export const Tax: React.FC< TaxProps > = ( { onComplete, query, task } ) => { updateAndPersistSettingsForGroup( 'tax', { tax: { ...taxSettings, - wc_connect_taxes_enabled: 'no', + woo_tax_taxes_enabled: 'no', }, } ); updateAndPersistSettingsForGroup( 'general', { @@ -138,7 +138,7 @@ export const Tax: React.FC< TaxProps > = ( { onComplete, query, task } ) => { updateAndPersistSettingsForGroup( 'tax', { tax: { ...taxSettings, - wc_connect_taxes_enabled: 'yes', + woo_tax_taxes_enabled: 'yes', }, } ), updateAndPersistSettingsForGroup( 'general', { diff --git a/src/free-trial/tax/utils.ts b/src/free-trial/tax/utils.ts index a3c3bf47..8c72b396 100644 --- a/src/free-trial/tax/utils.ts +++ b/src/free-trial/tax/utils.ts @@ -7,7 +7,7 @@ import { TaskType } from '@woocommerce/data'; /** * Plugins required to automate taxes. */ -export const AUTOMATION_PLUGINS = [ 'jetpack', 'woocommerce-services' ]; +export const AUTOMATION_PLUGINS = [ 'woocommerce-tax' ]; /** * Check if a store has a complete address given general settings. diff --git a/src/free-trial/tax/woocommerce-tax/card.tsx b/src/free-trial/tax/woocommerce-tax/card.tsx index 174952c6..c0d8bdaa 100644 --- a/src/free-trial/tax/woocommerce-tax/card.tsx +++ b/src/free-trial/tax/woocommerce-tax/card.tsx @@ -17,7 +17,7 @@ import { TaxChildProps } from '../utils'; export const Card: React.FC< TaxChildProps > = () => { return ( = () => { strong: , }, } ), - interpolateComponents( { - mixedString: __( - 'Powered by {{link}}Jetpack{{/link}}', - 'woocommerce' - ), - components: { - link: ( - - <> - - ), - }, - } ), // eslint-disable-next-line @wordpress/i18n-translator-comments __( '100% free', 'woocommerce' ), ] } terms={ interpolateComponents( { mixedString: __( - 'By installing WooCommerce Tax and Jetpack you agree to the {{link}}Terms of Service{{/link}}.', + 'By installing Woo Tax you agree to the {{link}}Terms of Service{{/link}}.', 'woocommerce' ), components: { diff --git a/src/free-trial/tax/woocommerce-tax/plugins.tsx b/src/free-trial/tax/woocommerce-tax/plugins.tsx index a8d5b4c0..94f88553 100644 --- a/src/free-trial/tax/woocommerce-tax/plugins.tsx +++ b/src/free-trial/tax/woocommerce-tax/plugins.tsx @@ -57,9 +57,9 @@ export const Plugins: React.FC< SetupStepProps > = ( { nextStep(); }, [ isResolving ] ); - const agreementText = pluginsToActivate.includes( 'woocommerce-services' ) + const agreementText = pluginsToActivate.includes( 'woocommerce-tax' ) ? __( - 'By installing Jetpack and WooCommerce Tax you agree to the {{link}}Terms of Service{{/link}}.', + 'By installing Woo Tax you agree to the {{link}}Terms of Service{{/link}}.', 'woocommerce' ) : __( diff --git a/src/free-trial/tax/woocommerce-tax/setup.tsx b/src/free-trial/tax/woocommerce-tax/setup.tsx index 1dce0ff1..b2d525fc 100644 --- a/src/free-trial/tax/woocommerce-tax/setup.tsx +++ b/src/free-trial/tax/woocommerce-tax/setup.tsx @@ -106,7 +106,7 @@ export const Setup: React.FC< SetupProps > = ( { key: 'connect', label: __( 'Automate Taxes', 'woocommerce' ), description: __( - 'WooCommerce Tax can automate your sales tax calculations for you.', + 'Woo Tax can automate your sales tax calculations for you.', 'woocommerce' ), content: ,