This repository was archived by the owner on Feb 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,14 @@ protected function enqueue_data( array $attributes = [] ) {
150150 *
151151 * $wp_scripts->print_translations() calls load_script_textdomain()
152152 * which calls load_script_translations() containing the below filter.
153+ *
154+ * In Customzier, woocommerce_blocks_get_i18n_data_json doesn't exist
155+ * at the time of this filter call. So we need checking for its
156+ * existence to prevent fatal error.
153157 */
154- remove_filter ( 'pre_load_script_translations ' , 'woocommerce_blocks_get_i18n_data_json ' , 10 , 4 );
158+ if ( function_exists ( 'woocommerce_blocks_get_i18n_data_json ' ) ) {
159+ remove_filter ( 'pre_load_script_translations ' , 'woocommerce_blocks_get_i18n_data_json ' , 10 , 4 );
160+ }
155161
156162 $ script_data = $ this ->asset_api ->get_script_data ( 'build/mini-cart-component-frontend.js ' );
157163
@@ -187,7 +193,9 @@ protected function enqueue_data( array $attributes = [] ) {
187193 );
188194
189195 // Re-add the filter.
190- add_filter ( 'pre_load_script_translations ' , 'woocommerce_blocks_get_i18n_data_json ' , 10 , 4 );
196+ if ( function_exists ( 'woocommerce_blocks_get_i18n_data_json ' ) ) {
197+ add_filter ( 'pre_load_script_translations ' , 'woocommerce_blocks_get_i18n_data_json ' , 10 , 4 );
198+ }
191199
192200 $ this ->asset_data_registry ->add (
193201 'mini_cart_block_frontend_dependencies ' ,
You can’t perform that action at this time.
0 commit comments