Add setting to control display of marketplace suggestions.

This commit is contained in:
Timmy Crawford 2019-04-05 13:38:30 -07:00
parent 437adec140
commit 4a2c706cc0
2 changed files with 25 additions and 0 deletions

View File

@ -178,6 +178,11 @@ class WC_Marketplace_Suggestions {
return false;
}
// Suggestions may be disabled via a setting under Accounts & Privacy.
if ( 'no' === get_option( 'woocommerce_show_marketplace_suggestions', 'yes' ) ) {
return false;
}
// User can disabled all suggestions via filter.
return apply_filters( 'woocommerce_allow_marketplace_suggestions', true );
}

View File

@ -255,6 +255,26 @@ class WC_Settings_Accounts extends WC_Settings_Page {
'type' => 'sectionend',
'id' => 'tracking_options',
),
array(
'title' => esc_html__( 'Marketplace suggestions', 'woocommerce' ),
'type' => 'title',
'id' => 'marketplace_suggestions',
'desc' => __( 'We show contextual suggestions for official extensions that may be helpful to your store.', 'woocommerce' ),
),
array(
'title' => __( 'Show Suggestions', 'woocommerce' ),
'desc' => __( 'Display suggestions within WooCommerce', 'woocommerce' ),
'desc_tip' => esc_html__( 'Leave this box unchecked if you do not want to see suggested extensions.', 'woocommerce' ),
'id' => 'woocommerce_show_marketplace_suggestions',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'default' => 'yes',
'autoload' => false,
),
array(
'type' => 'sectionend',
'id' => 'marketplace_suggestions',
),
)
);