Answer the question
In order to leave comments, you need to log in
Why is woocommerce only returning the integer part of the size?
Hello everyone,
let's say I have a product with a width of 5.75 and a height of 15.45 and the following function:
$product = new WC_Product($id);
public function get_sizes($product) {
$w_size = floatval($product->get_width());
$h_size = floatval($product->get_height());
$w_M = intval($w_size);
$h_M = intval($h_size);
$w_CM = $w_size - intval($w_size);
$h_CM = $h_size - intval($h_size);
return array($w_M, $h_M, $w_CM, $h_CM);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question