23 lines
539 B
PHP
23 lines
539 B
PHP
<?php
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
|
|
if ( !trait_exists( 'WPDesk_Can_Manage_DHL_Weight' ) ) {
|
|
|
|
trait WPDesk_Can_Manage_DHL_Weight {
|
|
|
|
/**
|
|
* Convert WooCommerce weight to DHL weight.
|
|
*
|
|
* @param string $wc_weight WooCommerce weight.
|
|
*
|
|
* @return float DHL weight.
|
|
*/
|
|
private function convert_wc_weight_to_dhl($wc_weight) {
|
|
$wc_weight = floatval($wc_weight);
|
|
$weight = wc_get_weight($wc_weight, 'kg' );
|
|
return ceil($weight);
|
|
}
|
|
}
|
|
}
|