Ensure these are only getting trimmed from the right side
Source Link
Lindsey D
  • 23.5k
  • 5
  • 47
  • 106

This can be done with Twig's trim filter. It works just like PHP's trim function.

{{ item.width|trim('0','right')|trim('.','right') }}

This can be done with Twig's trim filter. It works just like PHP's trim function.

{{ item.width|trim('0')|trim('.') }}

This can be done with Twig's trim filter. It works just like PHP's trim function.

{{ item.width|trim('0','right')|trim('.','right') }}
Caught error with that chopped off zeros
Source Link

This can be done with Twig's trim filter. It works just like PHP's trim function.

{{ item.width|trim('0')|trim('.0'') }}

This can be done with Twig's trim filter. It works just like PHP's trim function.

{{ item.width|trim('.0') }}

This can be done with Twig's trim filter. It works just like PHP's trim function.

{{ item.width|trim('0')|trim('.') }}
Source Link

This can be done with Twig's trim filter. It works just like PHP's trim function.

{{ item.width|trim('.0') }}