WC_Admin_Taxonomies::scripts_at_product_cat_screen_footer
Admin footer scripts for the product categories admin screen
Method of the class: WC_Admin_Taxonomies{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Admin_Taxonomies = new WC_Admin_Taxonomies(); $WC_Admin_Taxonomies->scripts_at_product_cat_screen_footer();
WC_Admin_Taxonomies::scripts_at_product_cat_screen_footer() WC Admin Taxonomies::scripts at product cat screen footer code WC 10.9.4
public function scripts_at_product_cat_screen_footer() {
$taxonomy = isset( $_GET['taxonomy'] ) ? sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( 'product_cat' !== $taxonomy ) {
return;
}
$handle = 'wc-admin-taxonomies';
wp_register_script( $handle, '', array(), WC_VERSION, array( 'in_footer' => true ) );
wp_enqueue_script( $handle );
// Ensure the tooltip is displayed when the image column is disabled on product categories.
wp_add_inline_script(
$handle,
sprintf(
"(function() {
'use strict';
const product_cat = document.getElementById('tag-%d');
if (product_cat) {
const th = product_cat.querySelector('th');
const thumbSpan = product_cat.querySelector('td.thumb span');
if (th && thumbSpan) {
th.innerHTML = '';
th.appendChild(thumbSpan);
}
}
})();",
absint( $this->default_cat_id )
)
);
}