yit_send_changes_to_db

The YITH WooCommerce Wishlist yit send changes to db function.

Description

yit_send_changes_to_db(); 

Usage

  1. if ( !function_exists( 'yit_send_changes_to_db' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yith-woocommerce-wishlist/plugin-fw/yit-woocommerce-compatibility.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = yit_send_changes_to_db(); 
  7.  

Defined (1)

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

/plugin-fw/yit-woocommerce-compatibility.php  
  1. function yit_send_changes_to_db() { 
  2. global $changed_objects; 
  3.  
  4. if ( !empty( $changed_objects ) ) { 
  5. foreach ( $changed_objects as $id => $data ) { 
  6. if ( version_compare( WC()->version, '2.7.0', '>=' ) ) { 
  7. /** 
  8. * @var $object \WC_Data 
  9. */ 
  10. $object = is_a( $data[ 'object' ], 'WC_Product' ) ? wc_get_product( $id ) : wc_get_order( $id ); 
  11.  
  12. yit_set_prop( $object, $data[ 'changes' ] ); 
  13. $object->save(); 
  14. } else { 
  15. $data[ 'ID' ] = $id; 
  16. wp_update_post( $data );