تابع ووکامرسی wc_delete_shop_order_transients حذف تمامی اطلاعات گذرا سفارش

تابع ووکامرسی wc_delete_shop_order_transients – حذف تمامی اطلاعات گذرا سفارش محصول
Syntax – سینتکس
wc_delete_shop_order_transients( (int) $order = 0 );
Parameters – پارامتر ها (1)
- 1- $order (int)
Usage – نحوه استفاده
if ( !function_exists( 'wc_delete_shop_order_transients' ) ) { require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-order-functions.php'; } // The order. $order = -1; // NOTICE! Understand what this does before running. $result = wc_delete_shop_order_transients($order);
Defined – محل تعریف
/includes/wc-order-functions.php
function wc_delete_shop_order_transients( $order = 0 ) { if ( is_numeric( $order ) ) { $order = wc_get_order( $order ); } $reports = WC_Admin_Reports::get_reports(); $transients_to_clear = array( wc_admin_report ); foreach ( $reports as $report_group ) { foreach ( $report_group['reports'] as $report_key => $report ) { $transients_to_clear[] = 'wc_report_' . $report_key; } } foreach ( $transients_to_clear as $transient ) { delete_transient( $transient ); } // Clear money spent for user associated with order if ( is_a( $order, 'WC_Order' ) ) { $order_id = $order->get_id(); delete_user_meta( $order->get_customer_id(), '_money_spent' ); delete_user_meta( $order->get_customer_id(), '_order_count' ); } else { $order_id = 0; } // Increments the transient version to invalidate cache WC_Cache_Helper::get_transient_version( 'orders', true ); // Do the same for regular cache WC_Cache_Helper::incr_cache_prefix( 'orders' ); do_action( 'woocommerce_delete_shop_order_transients', $order_id ); }
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر