/var/www/(Del)hsihk.com/wp-content/plugins/woocommerce/includes/updates/woocommerce-update-1.4.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
 * Update WC to 1.4
 *
 * @author         WooThemes
 * @category     Admin
 * @package     WooCommerce/Admin/Updates
 * @version     2.0.0
 */

if ( ! defined'ABSPATH' ) ) {
    exit; 
// Exit if accessed directly
}

global 
$wpdb$woocommerce;

// Upgrade from old downloadable/virtual product types
$downloadable_type get_term_by'slug''downloadable''product_type' );
if ( 
$downloadable_type ) {
    
$products get_objects_in_term$downloadable_type->term_id'product_type' );
    foreach ( 
$products as $product ) {
        
update_post_meta$product'_downloadable''yes' );
        
update_post_meta$product'_virtual''yes' );
        
wp_set_object_terms$product'simple''product_type');
    }
}

$virtual_type get_term_by'slug''virtual''product_type' );
if ( 
$virtual_type ) {
    
$products get_objects_in_term$virtual_type->term_id'product_type' );
    foreach ( 
$products as $product ) {
        
update_post_meta$product'_downloadable''no' );
        
update_post_meta$product'_virtual''yes' );
        
wp_set_object_terms$product'simple''product_type');
    }
}