wc_update_260_refunds

The WooCommerce wc update 260 refunds function.

Description

wc_update_260_refunds(); 

Usage

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

Defined (1)

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

/includes/wc-update-functions.php  
  1. function wc_update_260_refunds() { 
  2. global $wpdb; 
  3. /** 
  4. * Refund item qty should be negative 
  5. */ 
  6. $wpdb->query( " 
  7. UPDATE {$wpdb->prefix}woocommerce_order_itemmeta as item_meta 
  8. LEFT JOIN {$wpdb->prefix}woocommerce_order_items as items ON item_meta.order_item_id = items.order_item_id 
  9. LEFT JOIN {$wpdb->posts} as posts ON items.order_id = posts.ID 
  10. SET item_meta.meta_value = item_meta.meta_value * -1 
  11. WHERE item_meta.meta_value > 0 AND item_meta.meta_key = '_qty' AND posts.post_type = 'shop_order_refund' 
  12. " );