wc-admin-inline-scripts
Installation
SKILL.md
WooCommerce: admin inline scripts
Use this when adding or reviewing small JavaScript glue in WooCommerce admin screens, settings pages, shipping modals, product edit screens, or order admin UI.
Misconception this skill corrects
"WooCommerce has
wc_enqueue_js(), so use that for admin inline JS."
Do not use it. In WooCommerce 11.0.0 the function still exists, but it is deprecated since 10.4.0 with the replacement wp_add_inline_script(). It appends code to a global queue printed by wc_print_js() on wp_footer and admin_footer, wrapped in jQuery(function($) { ... }). That global footer queue is hard to scope, hard to dequeue, and not tied to a real script handle.
When to use this skill
Trigger when ANY of the following is true:
- Code contains
wc_enqueue_js(),wc_print_js(), orwoocommerce_queued_js. - Code echoes
<script>tags from WooCommerce admin PHP callbacks. - A Woo settings field, shipping method modal, product data tab, order screen, or custom Woo admin page needs a small script or PHP-to-JS data.
- You need to attach inline data to Woo admin handles such as
woocommerce_admin,wc-enhanced-select,wc-shipping-zones, or a plugin-owned admin script.