Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WooCommerce Analytics: make it available as module #15187

Merged
merged 6 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/phpcs-whitelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module.exports = [
'modules/verification-tools.php',
'modules/widgets/contact-info.php',
'modules/widgets/social-icons.php',
'modules/woocommerce-analytics.php',
'modules/wpcom-block-editor/class-jetpack-wpcom-block-editor.php',
'modules/wpcom-tos/wpcom-tos.php',
'packages',
Expand Down
14 changes: 14 additions & 0 deletions class.jetpack-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,20 @@ static function is_module_available( $module ) {
return false;
}

/*
* WooCommerce Analytics should only be available
* when running WooCommerce 3+
*/
if (
'woocommerce-analytics' === $module['module']
&& (
! class_exists( 'WooCommerce' )
|| version_compare( WC_VERSION, '3.0', '<' )
)
) {
return false;
}

if ( ( new Status() )->is_development_mode() ) {
return ! ( $module['requires_connection'] );
} else {
Expand Down
1 change: 0 additions & 1 deletion modules/module-extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
'calypsoify/class.jetpack-calypsoify.php',
'plugin-search.php',
'simple-payments/simple-payments.php',
'woocommerce-analytics/wp-woocommerce-analytics.php',
'wpcom-block-editor/class-jetpack-wpcom-block-editor.php',
'wpcom-tos/wpcom-tos.php',
);
Expand Down
7 changes: 7 additions & 0 deletions modules/module-headings.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ function jetpack_get_module_i18n( $key ) {
'description' => _x( 'Provides additional widgets for use on your site.', 'Module Description', 'jetpack' ),
),

'woocommerce-analytics' => array(
'name' => _x( 'WooCommerce Analytics', 'Module Name', 'jetpack' ),
'description' => _x( 'Enhanced analytics for WooCommerce and Jetpack users.', 'Module Description', 'jetpack' ),
),

'wordads' => array(
'name' => _x( 'Ads', 'Module Name', 'jetpack' ),
'description' => _x( 'Earn income by allowing Jetpack to display high quality ads.', 'Module Description', 'jetpack' ),
Expand All @@ -234,6 +239,7 @@ function jetpack_get_module_i18n_tag( $key ) {
// Modules with `Other` tag:
// - modules/contact-form.php
// - modules/notes.php
// - modules/woocommerce-analytics.php
'Other' =>_x( 'Other', 'Module Tag', 'jetpack' ),

// Modules with `Photos and Videos` tag:
Expand Down Expand Up @@ -300,6 +306,7 @@ function jetpack_get_module_i18n_tag( $key ) {
// - modules/sharedaddy.php
// - modules/sitemaps.php
// - modules/stats.php
// - modules/woocommerce-analytics.php
'Recommended' =>_x( 'Recommended', 'Module Tag', 'jetpack' ),

// Modules with `General` tag:
Expand Down
2 changes: 1 addition & 1 deletion modules/module-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ function jetpack_google_analytics_more_info() {
* WooCommerce Analytics support link.
*/
function jetpack_woocommerce_analytics_more_link() {
echo 'https://jetpack.com/support/';
echo 'https://jetpack.com/support/woocommerce-analytics/';
}
add_action( 'jetpack_learn_more_button_woocommerce-analytics', 'jetpack_woocommerce_analytics_more_link' );

Expand Down
22 changes: 22 additions & 0 deletions modules/woocommerce-analytics.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* Module Name: WooCommerce Analytics
* Module Description: Enhanced analytics for WooCommerce and Jetpack users.
* Sort Order: 13
* First Introduced: 8.4
* Requires Connection: Yes
* Auto Activate: Yes
* Module Tags: Other, Recommended
* Feature: Engagement
* Additional Search Queries: woocommerce, analytics, stats, statistics, tracking, analytics, views
*
* @package Jetpack
*/

/**
* Load module functionality.
*/
function jetpack_load_woocommerce_analytics() {
require_once dirname( __FILE__ ) . '/woocommerce-analytics/wp-woocommerce-analytics.php';
}
jetpack_load_woocommerce_analytics();