WCML_WC_Product_Bundles_Items

The WooCommerce Multilingual WCML WC Product Bundles Items class.

Defined (1)

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

/compatibility/includes/class-wcml-wc-product-bundles-items.php  
  1. class WCML_WC_Product_Bundles_Items{ 
  2.  
  3. /** 
  4. * @param int 
  5. * @return array 
  6. */ 
  7. public function get_items( $product_id ) { 
  8.  
  9. $items = array(); 
  10. $product_bundle = new WC_Product_Bundle( $product_id ); 
  11. if( $product_bundle ) { 
  12. $items = $product_bundle->get_bundled_items(); 
  13. return $items; 
  14.  
  15.  
  16. /** 
  17. * @param WC_Bundled_Item 
  18. * @return array 
  19. */ 
  20. function get_item_data( $bundled_item ) { 
  21. $item_data = $bundled_item->get_data(); 
  22. // #wcml-1927 - Insufficient Stock issue 
  23. if ( $item_data['max_stock'] === null ) { 
  24. $item_data['max_stock'] = ''; 
  25. return $item_data; 
  26.  
  27. function copy_item_data( $item_id_1, $item_id_2 ) { 
  28.  
  29. $item_1_data = $this->get_item_data_object( $item_id_1 ); 
  30. $item_2_data = $this->get_item_data_object( $item_id_2 ); 
  31.  
  32. $meta_data = $item_1_data->get_meta_data(); 
  33.  
  34. foreach( $meta_data as $key => $value ) { 
  35. $item_2_data->update_meta( $key, $value ); 
  36.  
  37. $item_2_data->save(); 
  38.  
  39. /** 
  40. * @param int 
  41. * @return WC_Bundled_Item_Data 
  42. */ 
  43. function get_item_data_object( $item_id ) { 
  44. return new WC_Bundled_Item_Data( $item_id ); 
  45.  
  46. /** 
  47. * @param WC_Bundled_Item_Data 
  48. * @param string 
  49. * @param mixed 
  50. */ 
  51. public function update_item_meta( $bundled_item_data, $key, $value ) { 
  52. $bundled_item_data->update_meta($key, $value ); 
  53.  
  54. /** 
  55. * @param WC_Bundled_Item_Data 
  56. */ 
  57. public function save_item_meta( $bundled_item_data ) { 
  58. $bundled_item_data->save(); 
  59.  
  60.