Add wc-blocks-registry as a dependency to product collection tester script
This commit is contained in:
parent
e83eb82f92
commit
d69dc0feef
|
@ -27,6 +27,20 @@ The `__experimentalRegisterProductCollection` function is part of the `@woocomme
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Be sure to add `wc-blocks-registry` as a dependency to your script if you opt to use the `wc` global.
|
||||||
|
|
||||||
|
```php
|
||||||
|
function enqueue_my_custom_product_collection_script() {
|
||||||
|
wp_enqueue_script(
|
||||||
|
'my-custom-product-collection',
|
||||||
|
plugins_url( '/dist/my-custom-product-collection.js', __FILE__ ),
|
||||||
|
array( 'wc-blocks-registry' ),
|
||||||
|
10
|
||||||
|
);
|
||||||
|
}
|
||||||
|
add_action( 'enqueue_block_editor_assets', 'enqueue_my_custom_product_collection_script' );
|
||||||
|
```
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> The first method is recommended if you are using Webpack.
|
> The first method is recommended if you are using Webpack.
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ function register_product_collections_script()
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'rpc_register_product_collections',
|
'rpc_register_product_collections',
|
||||||
plugins_url('register-product-collection-tester/index.js', __FILE__),
|
plugins_url('register-product-collection-tester/index.js', __FILE__),
|
||||||
array('wp-element', 'wp-blocks', 'wp-i18n', 'wp-components', 'wp-editor', 'wc-blocks'),
|
array('wp-element', 'wp-blocks', 'wp-i18n', 'wp-components', 'wp-editor', 'wc-blocks', 'wc-blocks-registry'),
|
||||||
filemtime(plugin_dir_path(__FILE__) . 'register-product-collection-tester/index.js'),
|
filemtime(plugin_dir_path(__FILE__) . 'register-product-collection-tester/index.js'),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue