wc_deferred_product_sync

Queue a product for syncing at the end of the request.

Description

wc_deferred_product_sync( (int) $product_id ); 

Parameters (1)

0. $product_id (int)
The product id.

Usage

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

Defined (1)

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

/includes/wc-product-functions.php  
  1. function wc_deferred_product_sync( $product_id ) { 
  2. global $wc_deferred_product_sync; 
  3.  
  4. if ( empty( $wc_deferred_product_sync ) ) { 
  5. $wc_deferred_product_sync = array(); 
  6.  
  7. $wc_deferred_product_sync[] = $product_id;