How do I add a custom twig function?

You can use the 
add() method to add a custom twig function:
\Aero\Store\Twig\Extensions\TwigFunctions::add([
    new \Twig\TwigFunction('foo', function () {
        return 'bar';
    }),
]);
And then use it in twig:
{{ foo() }}