تابع wc_get_chosen_shipping_method_ids دریافت آیدی روش حمل و نقل انتخاب شده

تابع ووکامرسی wc_get_chosen_shipping_method_ids دریافت آیدی روش حمل و نقل انتخاب شده از طریق session های ووکامرس
Syntax – سینتکس
(string[]) wc_get_chosen_shipping_method_ids();
Usage – نحوه استفاده
if ( !function_exists( 'wc_get_chosen_shipping_method_ids' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-cart-functions.php';
}
// NOTICE! Understand what this does before running.
$result = wc_get_chosen_shipping_method_ids();
Defined – محل تعریف
/includes/wc-cart-functions.php
function wc_get_chosen_shipping_method_ids() {
$method_ids = array();
$chosen_methods = WC()->session->get( 'chosen_shipping_methods', array() );
foreach ( $chosen_methods as $chosen_method ) {
$chosen_method = explode( ':', $chosen_method );
$method_ids[] = current( $chosen_method );
}
return $method_ids;
}
versions – نسخه ها
از نسخه : 2.6.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر