تابع wc_cart_totals_shipping_method_label دریافت هزینه و نام روش های حمل و نقل

تابع wc_cart_totals_shipping_method_label دریافت هزینه و نام روش های حمل و نقل

تابع ووکامرسی wc_cart_totals_shipping_method_label – دریافت هزینه و نام روش های حمل و نقل

Syntax – سینتکس

(string) wc_cart_totals_shipping_method_label( (WC_Shipping_Rate) $method ); 

Parameters – پارامتر ها (1)

  • 1- $method (WC_Shipping_Rate)

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

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

Defined – محل تعریف

/includes/wc-cart-functions.php

function wc_cart_totals_shipping_method_label( $method ) { 
    $label = $method->get_label(); 
 
    if ( $method->cost > 0 ) { 
        if ( WC()->cart->tax_display_cart == 'excl' ) { 
            $label .= ': ' . wc_price( $method->cost ); 
            if ( $method->get_shipping_tax() > 0 && WC()->cart->prices_include_tax ) { 
                $label .= ' ' . WC()->countries->ex_tax_or_vat() . ''; 
            } 
        } else { 
            $label .= ': ' . wc_price( $method->cost + $method->get_shipping_tax() ); 
            if ( $method->get_shipping_tax() > 0 && ! WC()->cart->prices_include_tax ) { 
                $label .= ' ' . WC()->countries->inc_tax_or_vat() . ''; 
            } 
        } 
    } 
 
    return apply_filters( 'woocommerce_cart_shipping_method_full_label', $label, $method ); 
} 

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