woocommerce_interactivity_move_interactive_scripts_to_the_footer()
Move interactive scripts to the footer. This is a temporary measure to make it work with wc_store and it should be replaced with deferred scripts or modules.
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
woocommerce_interactivity_move_interactive_scripts_to_the_footer();
Код woocommerce_interactivity_move_interactive_scripts_to_the_footer() woocommerce interactivity move interactive scripts to the footer WC 9.4.2
function woocommerce_interactivity_move_interactive_scripts_to_the_footer() { // Move the @woocommerce/interactivity package to the footer. wp_script_add_data( 'wc-interactivity', 'group', 1 ); // Move all the view scripts of the interactive blocks to the footer. $registered_blocks = \WP_Block_Type_Registry::get_instance()->get_all_registered(); foreach ( array_values( $registered_blocks ) as $block ) { if ( isset( $block->supports['interactivity'] ) && $block->supports['interactivity'] ) { foreach ( $block->view_script_handles as $handle ) { wp_script_add_data( $handle, 'group', 1 ); } } } }