wc_enqueue_js

Queue some JavaScript code to be output in the footer.

Description

wc_enqueue_js( (string) $code ); 

Parameters (1)

0. $code (string)
The code.

Usage

  1. if ( !function_exists( 'wc_enqueue_js' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; 
  3.  
  4. // The code. 
  5. $code = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_enqueue_js($code); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-core-functions.php  
  1. function wc_enqueue_js( $code ) { 
  2. global $wc_queued_js; 
  3.  
  4. if ( empty( $wc_queued_js ) ) { 
  5. $wc_queued_js = ''; 
  6.  
  7. $wc_queued_js .= "\n" . $code . "\n";