تابع ووکامرسی wc_format_weight فرمت و نمایش وزن کالا

تابع ووکامرسی wc_format_weight فرمت و نمایش وزن کالا

تابع ووکامرسی wc_format_weight – فرمت و نمایش وزن کالا

Syntax – سینتکس

(string) wc_format_weight( (float) $weight ); 

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

  • 1- $weight (float)

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

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

Defined – محل تعریف

/includes/wc-formatting-functions.php

function wc_format_weight( $weight ) { 
    $weight_string = wc_format_localized_decimal( $weight ); 
 
    if ( ! empty( $weight_string ) ) { 
        $weight_string .= ' ' . get_option( 'woocommerce_weight_unit' ); 
    } else { 
        $weight_string = __( 'N/A', woocommerce ); 
    } 
 
    return apply_filters( 'woocommerce_format_weight', $weight_string, $weight ); 
} 

versions – نسخه ها

از نسخه : 3.0.0

نسخه فعلی : 3.0.6

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

ارسال نظر

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

contact us