-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathwc-performance-improvements.php
127 lines (102 loc) · 4.52 KB
/
wc-performance-improvements.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/**
* Plugin Name: Performance Improvements for WooCommerce
* Plugin URI: https://github.com/lukecav/performance-improvements-for-woocommerce
* Description: Performance tweaks for WooCommerce.
* Version: 1.1.27
* Author: Luke Cavanagh
* Author URI: https://github.com/lukecav
* Requires at least: 5.6
* Requires PHP: 7.4
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*
* WC requires at least: 5.0
* WC tested up to: 8.6
*
* @package WooCommerce_Performance_Improvements
* @author Luke Cavanagh
*/
// Remove order total from my account orders
add_filter('woocommerce_my_account_my_orders_columns', 'remove_my_account_order_total', 10);
function remove_my_account_order_total($order){
unset($order['order-total']);
return $order;
}
// Remove order count from admin menu
add_filter( 'woocommerce_include_processing_order_count_in_menu', '__return_false' );
// Disable status dashboard widget
function disable_woocommerce_status_remove_dashboard_widgets() {
remove_meta_box( 'woocommerce_dashboard_status', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'disable_woocommerce_status_remove_dashboard_widgets', 40);
// Disable reviews dashboard widget
function disable_woocommerce_reviews_remove_dashboard_widgets() {
remove_meta_box( 'woocommerce_dashboard_recent_reviews', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'disable_woocommerce_reviews_remove_dashboard_widgets', 40);
// Hide tags, featured and type admin columns from the product list
function unset_some_columns_in_product_list( $column_headers ) {
unset($column_headers['product_tag']);
unset($column_headers['featured']);
unset($column_headers['product_type']);
return $column_headers;
}
add_filter( 'manage_edit-product_columns', 'unset_some_columns_in_product_list' );
// Disable background image regeneration
add_filter( 'woocommerce_background_image_regeneration', '__return_false' );
// Disable password strength
function deregister_or_dequeue_scripts() {
wp_dequeue_script('wc-password-strength-meter');
}
add_action('wp_print_scripts', 'deregister_or_dequeue_scripts', 20);
// Increase the default batch limit of 50 in the CSV product exporter to a more usable 5000
add_filter( 'woocommerce_product_export_batch_limit', function () {
return 5000;
}, 999 );
// Remove marketplace suggestions
add_filter( 'woocommerce_allow_marketplace_suggestions', '__return_false' );
// Remove connect your store to WooCommerce.com admin notice
add_filter( 'woocommerce_helper_suppress_admin_notices', '__return_true' );
// Deregister block style from WooCommerce
add_filter( 'woocommerce_show_admin_notice', 'wc_disable_wc_admin_install_notice', 10, 2 );
function wc_disable_wc_admin_install_notice( $notice_enabled, $notice ) {
if ( 'wc_admin' === $notice ) {
return false;
}
return $notice_enabled;
}
// Disable the WooCommerce Admin
add_filter( 'woocommerce_admin_disabled', '__return_true' );
// Disable the WooCommere Marketing Hub
add_filter( 'woocommerce_admin_features', 'disable_features' );
function disable_features( $features ) {
$marketing = array_search('marketing', $features);
unset( $features[$marketing] );
return $features;
}
// Supress WooCommerce Helper Admin Notices
add_filter( 'woocommerce_helper_suppress_admin_notices', '__return_true' );
// Remove Processing Order Count in wp-admin
add_filter( 'woocommerce_menu_order_count', 'false' );
// Disable native lazy loading
add_filter( 'wp_lazy_loading_enabled', '__return_false' );
// Disable WooCommerce no-cache headers
add_filter( 'woocommerce_enable_nocache_headers', '__return_false' );
// Disable setup widget
function disable_woocommerce_setup_remove_dashboard_widgets() {
remove_meta_box( 'wc_admin_dashboard_setup', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'disable_woocommerce_setup_remove_dashboard_widgets', 40);
// Hide marketplace and my subscriptions submenus
function wc_hide_woocommerce_menus() {
//Hide "WooCommerce → Marketplace".
remove_submenu_page('woocommerce', 'wc-addons');
//Hide "WooCommerce → My Subscriptions".
remove_submenu_page('woocommerce', 'wc-addons§ion=helper');
}
add_action('admin_menu', 'wc_hide_woocommerce_menus', 71);
// Delete the WooCommerce usage tracker cron event
wp_clear_scheduled_hook( 'woocommerce_tracker_send_event' );
// Disable the Payment Gateway Admin Suggestions
add_filter('woocommerce_admin_payment_gateway_suggestion_specs', '__return_empty_array');