On my WooCommerce website I have fabric set to be sold per half meter, with the code below which is all working fine:
function conditional_price_suffix( $price, $product ) {
$product_id = $product->is_type('variation') ? $product->get_parent_id() : $product->get_id();
$product_categories = array('half-metre');
if( has_product_categories( $product_categories, $product_id ) )
$price .= ' ' . __('per ½ metre');
return $price;
}
However, how do I manipulate the code to add another option of per "quarter-metre" and output "per ¼ meter" as the suffix.
Any help?