Normal view

WooCommerce 11.1 Delivers Faster REST and Store API Requests by Skipping Block Registration

Faster REST and Store API requests

WooCommerce block types and patterns were previously registered on nearly every request, including many that never render or edit blocks. We are changing that deliberately: a request should only pay for block registration when it can actually render or edit blocks.

The first step shipped in WooCommerce 11.0, where patterns register by file path and their content is loaded only when the editor requests it, matching WordPress core and saving 5–8 ms on every request that registers blocks .

WooCommerce 11.1 completes the change: a new BlockRegistrationContext guard now skips block and pattern registration on non-rendering requests. One exception is built in: when a product or variation description contains a WooCommerce block, block types are registered on demand via the woocommerce_short_description filter, so descriptions still render correctly in the products REST API, the Store API, the variation AJAX endpoint, and product webhooks.

Front-end, core admin, and block/site editor requests are unchanged, and the guard only skips contexts it recognizes; anything else keeps registering blocks, so a missed case costs a little performance, never a rendering regression.

The benefit: Store API and WooCommerce REST requests are 13–18 ms (30–42%) faster in our measurements.

How can developers tell if they are affected?

This applies from WooCommerce 11.1.0. You are affected only if your extension renders WooCommerce blocks, or relies on WooCommerce block types, patterns, or per-block assets being registered, during one of the skipped requests above. A WooCommerce block comes back as raw block markup (<!– wp:woocommerce/… –>) or as static HTML without its dynamic output which can be confirmed in code:

// Returns false in a skipped context on WooCommerce 11.1+.

WP_Block_Type_Registry::get_instance()->is_registered( 'woocommerce/mini-cart' );


Product and variation descriptions need no action; they are handled on demand. Blocks your extension registers itself with register_block_type() are also unaffected; so this only covers registration done by WooCommerce.

What action do developers need to take if affected?

Opt back in with the new woocommerce_should_register_blocks filter; return true only for the requests where you actually render blocks:

add_filter(

'woocommerce_should_register_blocks',

function ( $should_register ) {

	return my_context_renders_blocks() ? true : $should_register;

}

);

The filter runs on plugins_loaded, before the main query is parsed, so the condition can only rely on what’s available that early ($_SERVER, $_GET).

Please test your extension against WooCommerce 11.1 before the final release.

One more recommendation: don’t build your blocks on AbstractBlock. It’s an internal class, and blocks built on it inherit every registration decision WooCommerce makes, including the skips above; its lifecycle will keep changing as we optimize registration.

The supported way to create a block is the standard WordPress Block API: define it in block.json and register it with register_block_type() on init. Good starting points: Scaffolding and sample store data, @wordpress/create-block, and for Cart and Checkout inner blocks the @woocommerce/extend-cart-checkout-block template.

The post WooCommerce 11.1 Delivers Faster REST and Store API Requests by Skipping Block Registration appeared first on The WooCommerce Developer Blog.

Retiring stable feature flags in WooCommerce 11.1

Retiring stable WooCommerce Admin feature flags in WooCommerce 11.1

WooCommerce 11.1 retires a set of stable WooCommerce Admin feature flags from the normal feature configuration pipeline.

These features are no longer experimental or optional, so WooCommerce now loads them directly instead of treating entries in core.json, development.json, or window.wcAdminFeatures as the source of truth for whether the feature should be available.

This change should not remove functionality from stores. The affected features continue to be available. To preserve backward compatibility, WooCommerce 11.1 includes deprecated PHP and JavaScript compatibility shims for existing checks.

For example, calls such as:

Features::is_enabled( 'launch-your-store' );

Features::exists( 'customize-store' );

Direct JavaScript access such as:

window.wcAdminFeatures[ 'launch-your-store' ];

These will continue to return compatibility values for now. However, these checks are deprecated and will emit deprecation warnings. The compatibility layer is intended to give extension developers time to remove feature-flag-based gates before the shims are removed in a future WooCommerce version.

Who is affected?

This affects extensions and custom code that check retired WooCommerce Admin feature flags before loading UI, routes, tasks, recommendations, or other WooCommerce Admin behavior.

Developers should audit their code for usage of:

Features::is_enabled()

Features::exists()

Features::get_available_features()

Features::get_optional_feature_options()

Features::enable()

Features::disable()

window.wcAdminFeatures

– the woocommerce_admin_features filter when used to control stable WooCommerce Admin features

In most cases, checks for retired stable feature flags can be removed because the related feature is now treated as stable and available.

Affected feature flags

The retired compatibility shims include the following feature slugs:

activity-panels

analytics

analytics-scheduled-import

experimental-iapi-mini-cart

coupons

core-profiler

customize-store

customer-effort-score-tracks

import-products-task

experimental-fashion-sample-products

shipping-smart-defaults

shipping-setting-tour

homescreen

marketing

mobile-app-banner

onboarding

onboarding-tasks

pattern-toolkit-full-composability

payment-gateway-suggestions

product-custom-fields

printful

remote-inbox-notifications

remote-free-extensions

shipping-label-banner

subscriptions

transient-notices

wc-pay-promotion

wc-pay-welcome-page

woo-mobile-welcome

launch-your-store

Developers should use the underlying option or supported API when they need to check behavior that remains configurable.

About woocommerce_admin_features

The woocommerce_admin_features filter should no longer be used to control retired stable WooCommerce Admin features.

WooCommerce now loads these features directly, so removing a retired stable slug from the filtered feature list is not a supported way to disable the underlying feature behavior. Deprecated compatibility lookups may still reflect legacy filtered values while the shim exists, but those lookups now emit deprecation warnings and should be removed.

Extensions that currently use woocommerce_admin_features to gate stable WooCommerce Admin features should migrate away from that pattern and use the actual option or API for behavior that remains configurable.

Deprecated helpers

The following legacy helpers are also deprecated:

Features::get_optional_feature_options();

Features::enable();

Features::disable();

New code should avoid using WooCommerce Admin feature flags as extension points for stable feature behavior.

Timeline

These compatibility shims are deprecated in WooCommerce 11.1 and are planned for removal in a future WooCommerce version.

The post Retiring stable feature flags in WooCommerce 11.1 appeared first on The WooCommerce Developer Blog.

Changes to order item deletion in WooCommerce 11.1

WooCommerce 11.0 introduced deferred order-item deletion: remove_order_items() clears items in memory, while database deletion occurs and the woocommerce_removed_order_items hook fires during the next save().

In WooCommerce 11.1, we changed how WC_Abstract_Order::remove_order_items() handles persisted order items.

Core data stores now record the IDs of order items present when removal is requested. Only those IDs will be deleted when the order is saved. This prevents extensions that save replacement items before $order->save() from having those new items accidentally deleted.

Custom order data stores overriding delete_items() retain synchronous deletion. They can opt into deferred deletion by also overriding the new optional delete_items_by_ids() method. Developers should check custom stores for incompatible existing get_item_ids() or delete_items_by_ids() declarations.

The existing hooks and arguments are unchanged. On the deferred path, woocommerce_removed_order_items fires when deletion occurs during $order->save().

Most extensions require no changes. Developers maintaining custom order data stores should review their deletion methods and any code relying on immediate deletion or hook timing.

Related: #67975, #68107.

The post Changes to order item deletion in WooCommerce 11.1 appeared first on The WooCommerce Developer Blog.

❌