Enable Block Editor for WC Products
Enable Block Editor for WC Products turns on the WordPress block editor (Gutenberg) for WooCommerce products and provides a generic, extensible saver framework so plugin data persists when you press «Update». The bundled reference adapter fixes WooCommerce variations: variation edits persist on «Update» without having to click the variations panel «Save changes» button.
Why this plugin exists. WooCommerce is not going to add block-editor support to the current product editor. Instead, it will eventually release a brand-new product editor (v3) — a completely fresh interface — but that work is only just starting and may take a long time to ship. Until that day comes, this plugin lets you edit your WooCommerce products with the block editor (Gutenberg) today. It is a temporary bridge, not a permanent replacement: when the new v3 product editor is finally released, you can simply deactivate this plugin.
This also addresses the silent data loss described in WooCommerce issue #35242, which will not be fixed in the current editor: WooCommerce does not support the core block editor for products, so panels that save over their own AJAX channel can lose data on «Update». This plugin bridges that gap in the meantime.
What actually breaks in Gutenberg (and what does not)
When the block editor is enabled for products, pressing «Update» saves the post over REST. Two kinds of third-party data behave differently:
- Standard meta boxes that save on
save_postreading$_POSTalready persist in Gutenberg via WordPress’ meta box compatibility layer. They need nothing from this plugin. - Save routines bound to the classic form submit via a private AJAX channel (WooCommerce variations, or a panel with its own AJAX save/actions) break, because that submit event does not exist in the block editor. The generic solution is a savers registry that each plugin opts into.
This plugin is that framework. The WooCommerce variations saver is just the bundled reference adapter, registered through the same public API any third party uses.
How it works
The bridge listens to the Gutenberg save cycle (wp.data.subscribe, the saving→saved transition, autosaves ignored). On each save it runs the registered savers; each saver re-triggers a native save (typically by clicking the plugin’s own button) only when its rows are dirty. The bundled adapter clicks WooCommerce’s button.save-variation-changes when there are .variation-needs-update rows, firing WooCommerce’s own woocommerce_save_variations AJAX (which carries its nonce and capability checks). The plugin never serializes fields by hand and adds no REST endpoints.
Two strategies
- Bridge (default): Gutenberg on all products plus the variation save bridge.
- Classic (fallback): variable products edit in the classic editor; the bridge is not loaded. Enable with
define( 'EBEFWCP_MODE', 'classic' );or theebefwcp_modefilter.
For plugin developers
Register your own saver through the public API exposed on window.ebefwcp:
window.ebefwcp.registerSaver( { id: 'my-plugin/my-panel', dirtySelector: '#my_panel .my-row.needs-update', buttonSelector: 'button.my-plugin-save' } );
Full JS and PHP extension points, plus an AJAX integration guide, are documented in the plugin’s docs/api/ directory.