From e27af6dc30a7199b51890f78fcdd405a75ded6d9 Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Fri, 24 Apr 2026 01:14:03 +0700 Subject: [PATCH] =?UTF-8?q?refactor:=20remove=20WooCommerce=20asset=20dequ?= =?UTF-8?q?eue=20=E2=80=94=20WC=20not=20used=20on=20this=20site?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/perf-asset-policy.php | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/inc/perf-asset-policy.php b/inc/perf-asset-policy.php index 90f4d13..7374462 100644 --- a/inc/perf-asset-policy.php +++ b/inc/perf-asset-policy.php @@ -4,7 +4,7 @@ * * Optimizes the front-end asset graph by dequeuing unnecessary plugin styles/scripts * and slimming font requests. Targets mobile LCP improvement through: - * - Conditional dequeue of WC, Elementor, and USMI assets + * - Conditional dequeue of Elementor and USMI assets * - Google Fonts weight slimming (36 faces → 5) * - Preconnect hints for font.googleapis.com + fonts.gstatic.com * - Defer attribute on cookie-notice script @@ -49,11 +49,10 @@ function peptide_starter_perf_asset_policy_init() { /** * Dequeue assets on non-applicable page types. * - * Removes WooCommerce, Elementor, and Ultimate Social Media Icons assets from pages + * Removes Elementor and Ultimate Social Media Icons assets from pages * that don't use them. Controlled by the kill-switch constant PEPTIDE_STARTER_PERF_DEQUEUE. * * Dequeue conditions: - * - WC: removed unless on shop, cart, checkout, or account pages * - Elementor: removed if page doesn't use Elementor builder * - USMI: removed on homepage, archives, and blog index * @@ -65,28 +64,6 @@ function peptide_starter_perf_dequeue_plugin_assets() { return; } - // WooCommerce assets: dequeue on non-shop pages. - if ( function_exists( 'is_woocommerce' ) && ! is_woocommerce() && ! is_cart() && ! is_checkout() && ! is_account_page() ) { - // Get configured WC handles from filter; default list. - $wc_styles = apply_filters( - 'peptide_starter_perf_woocommerce_styles', - array( 'woocommerce-layout', 'woocommerce-smallscreen', 'woocommerce-general' ) - ); - - foreach ( $wc_styles as $handle ) { - wp_dequeue_style( $handle ); - } - - $wc_scripts = apply_filters( - 'peptide_starter_perf_woocommerce_scripts', - array( 'wc-add-to-cart', 'woocommerce', 'sourcebuster-js', 'wc-order-attribution' ) - ); - - foreach ( $wc_scripts as $handle ) { - wp_dequeue_script( $handle ); - } - } - // Elementor assets: dequeue if page doesn't use Elementor. if ( ! peptide_starter_page_uses_elementor( get_queried_object_id() ) ) { $elementor_handles = apply_filters(