How to change the Drupal Commerce Stock formatter?
If you want to display the stock of a product with 4+ when it's >5, assuming that you've got stock a field attached to the product and exposed to the node display (default behavior) you can use hook_entity_view_alter or hook_node_view_alter to alter the #markup of $build['product:field_stock']