wc_update_220_order_status بروزرسانی لیست وضعیت سفارش ووکامرس نسخه 2.2.0

wc_update_220_order_status بروزرسانی لیست وضعیت سفارش ووکامرس نسخه 2.2.0

تابع ووکامرسی wc_update_220_order_status – بروزرسانی لیست وضعیت سفارش ووکامرس به نسخه 2.2.0

Syntax – سینتکس

wc_update_220_order_status(); 

Usage – نحوه استفاده

if ( !function_exists( 'wc_update_220_order_status' ) ) { 
    require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-update-functions.php'; 
} 
 
  
// NOTICE! Understand what this does before running. 
$result = wc_update_220_order_status(); 
    

Defined – محل تعریف

/includes/wc-update-functions.php

function wc_update_220_order_status() { 
    global $wpdb; 
    $wpdb->query( " 
        UPDATE {$wpdb->posts} as posts 
        LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
        LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
        LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
        SET posts.post_status = 'wc-pending' 
        WHERE posts.post_type = 'shop_order' 
        AND posts.post_status = 'publish' 
        AND tax.taxonomy = 'shop_order_status' 
        AND    term.slug LIKE 'pending%'; 
        " 
 ); 
    $wpdb->query( " 
        UPDATE {$wpdb->posts} as posts 
        LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
        LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
        LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
        SET posts.post_status = 'wc-processing' 
        WHERE posts.post_type = 'shop_order' 
        AND posts.post_status = 'publish' 
        AND tax.taxonomy = 'shop_order_status' 
        AND    term.slug LIKE 'processing%'; 
        " 
 ); 
    $wpdb->query( " 
        UPDATE {$wpdb->posts} as posts 
        LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
        LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
        LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
        SET posts.post_status = 'wc-on-hold' 
        WHERE posts.post_type = 'shop_order' 
        AND posts.post_status = 'publish' 
        AND tax.taxonomy = 'shop_order_status' 
        AND    term.slug LIKE 'on-hold%'; 
        " 
 ); 
    $wpdb->query( " 
        UPDATE {$wpdb->posts} as posts 
        LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
        LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
        LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
        SET posts.post_status = 'wc-completed' 
        WHERE posts.post_type = 'shop_order' 
        AND posts.post_status = 'publish' 
        AND tax.taxonomy = 'shop_order_status' 
        AND    term.slug LIKE 'completed%'; 
        " 
 ); 
    $wpdb->query( " 
        UPDATE {$wpdb->posts} as posts 
        LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
        LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
        LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
        SET posts.post_status = 'wc-cancelled' 
        WHERE posts.post_type = 'shop_order' 
        AND posts.post_status = 'publish' 
        AND tax.taxonomy = 'shop_order_status' 
        AND    term.slug LIKE 'cancelled%'; 
        " 
 ); 
    $wpdb->query( " 
        UPDATE {$wpdb->posts} as posts 
        LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
        LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
        LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
        SET posts.post_status = 'wc-refunded' 
        WHERE posts.post_type = 'shop_order' 
        AND posts.post_status = 'publish' 
        AND tax.taxonomy = 'shop_order_status' 
        AND    term.slug LIKE 'refunded%'; 
        " 
 ); 
    $wpdb->query( " 
        UPDATE {$wpdb->posts} as posts 
        LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
        LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
        LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
        SET posts.post_status = 'wc-failed' 
        WHERE posts.post_type = 'shop_order' 
        AND posts.post_status = 'publish' 
        AND tax.taxonomy = 'shop_order_status' 
        AND    term.slug LIKE 'failed%'; 
        " 
 ); 
} 

versions – نسخه ها

از نسخه : 3.0.2

نسخه فعلی : 3.0.6

دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2

ارسال نظر

جهت استفاده از کد حتما از تگ pre استفاده نمایید .

contact us