yit_save_prop

The YITH WooCommerce Wishlist yit save prop function.

Description

yit_save_prop( $object, $arg1, (constant) $arg2 = false, (bool) $force_update = false ); 

Parameters (4)

0. $object
The object.
1. $arg1
The arg1.
2. $arg2 — Optional. (constant) => false
The arg2.
3. $force_update — Optional. (bool) => false
The force update.

Usage

  1. if ( !function_exists( 'yit_save_prop' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yith-woocommerce-wishlist/plugin-fw/yit-woocommerce-compatibility.php'; 
  3.  
  4. // The object. 
  5. $object = null; 
  6.  
  7. // The arg1. 
  8. $arg1 = null; 
  9.  
  10. // The arg2. 
  11. $arg2 = false; 
  12.  
  13. // The force update. 
  14. $force_update = false; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = yit_save_prop($object, $arg1, $arg2, $force_update); 
  18.  

Defined (1)

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

/plugin-fw/yit-woocommerce-compatibility.php  
  1. function yit_save_prop( $object, $arg1, $arg2 = false, $force_update = false ) { 
  2. if ( !is_array( $arg1 ) ) { 
  3. $arg1 = array( 
  4. $arg1 => $arg2 
  5. ); 
  6.  
  7. $is_wc_data = $object instanceof WC_Data; 
  8.  
  9. foreach ( $arg1 as $key => $value ) { 
  10. yit_set_prop( $object, $key, $value ); 
  11.  
  12. if ( !$is_wc_data ) { 
  13.  
  14. if ( yit_wc_check_post_columns( $key ) ) { 
  15. yit_store_changes( $object->post, $key, $value ); 
  16. } else { 
  17. $object_id = is_callable( array( $object, 'get_id' ) ) ? $object->get_id() : $object->id; 
  18.  
  19. update_post_meta( $object_id, $key, $value ); 
  20.  
  21. if ( $is_wc_data ) { 
  22. $object->save();