Drupal Commerce 2.x Notes & code snippets
Unless you know you want to be reading this you probably don't! It's currently a dumping ground for Commerce 2.x notes and code that we've come across and are likely to need again some time, maybe you need them too?
Formatting prices in code:
NumberFormatterFactoryInterface $number_formatter_factory to create a numberFormatter instance: $this->numberFormatter = $number_formatter_factory->createInstance();
Then set the details you want:
$this->numberFormatter = $number_formatter_factory->createInstance();