Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Custom Javascript

Paul Kilmurray edited this page Oct 31, 2015 · 1 revision

You can enqueue javascript using the woocommerce_pos_enqueue_footer_js filter.

Enqueuing inline javascript

function my_custom_pos_inline_js($js){
    $js['my_custom_pos_inline_js'] = 'var foo = "bar";';
    return $js;
}
add_filter('woocommerce_pos_enqueue_footer_js', 'my_custom_pos_inline_js');

Enqueuing a javascript file

function my_custom_pos_js_file($js){
    $js['my_custom_pos_js_file'] = 'http://yourdomain/path/to/your/file.js';
    return $js;
}
add_filter('woocommerce_pos_enqueue_footer_js', 'my_custom_pos_js_file');