I'm trying to modify dimensions output that everywhere where get_dimensions()
is called instead of default it would include letter of dimension.
So it would be 1 L x 1 W x 1 H instead of 1 x 1 x 1
Can I overwrite get_dimensions()
function and include letter alongside each value in array or I can somehow use wc_format_dimensions()
to do this?
Updated: You can't override
get_dimensions()
WC_Product
method.But you can use
woocommerce_format_dimensions
filter hook located inwc_format_dimensions()
function, to add custom labels to each dimension product attribute, this way (just as you want):Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
This code is tested on WooCommerce versions 3+ and works