Commit 3f0ec43ba0e for woocommerce
commit 3f0ec43ba0e5084d12e23a4a642ca6da84fce1d8
Author: Vladimir Reznichenko <kalessil@gmail.com>
Date: Wed Nov 4 17:05:04 2026 +0100
[Performance] Skip payment gateways initialization when rendering mini-cart (#70622)
Since mini-cart doesn't support express payment methods, we can skip payment gateways instantiation altogether for mini-cart (while keeping cart/checkout behavior unchanged; with payment extensions, initialization time scales up unpredictably).
diff --git a/plugins/woocommerce/changelog/performance-mini-cart-skip-payment-gateways-initialization b/plugins/woocommerce/changelog/performance-mini-cart-skip-payment-gateways-initialization
new file mode 100644
index 00000000000..1ad493217be
--- /dev/null
+++ b/plugins/woocommerce/changelog/performance-mini-cart-skip-payment-gateways-initialization
@@ -0,0 +1,4 @@
+Significance: minor
+Type: performance
+
+Skip payment gateways initialization when rendering mini-cart.
diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php b/plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php
index ccf63b461cd..897985839ee 100644
--- a/plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php
+++ b/plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php
@@ -231,6 +231,10 @@ class MiniCart extends AbstractBlock {
$template_part_edit_uri
);
+ // Performance note: prevent populating 'paymentMethodSortOrder' in '\Automattic\WooCommerce\Blocks\Payments\Api::add_payment_method_script_data',
+ // which initializes all registered payment gateways (triggers bulk autoloading and objects allocations; some environments not handling this well).
+ $this->asset_data_registry->add( 'paymentMethodSortOrder', array() );
+
/**
* Fires after cart block data is registered.
*