diff --git a/src/Sylius/Abstraction/StateMachine/composer.json b/src/Sylius/Abstraction/StateMachine/composer.json
index 8ff77e68958..d5c05226858 100644
--- a/src/Sylius/Abstraction/StateMachine/composer.json
+++ b/src/Sylius/Abstraction/StateMachine/composer.json
@@ -27,6 +27,9 @@
"winzou/state-machine": "^0.4",
"winzou/state-machine-bundle": "^0.6"
},
+ "suggest": {
+ "twig/twig": "Access the state machine in your twig templates (^2.12|^3.3)"
+ },
"require-dev": {
"matthiasnoback/symfony-config-test": "^4.2",
"phpunit/phpunit": "^9.5",
diff --git a/src/Sylius/Abstraction/StateMachine/config/services.xml b/src/Sylius/Abstraction/StateMachine/config/services.xml
index 8ec1b9840e4..6edb530acd9 100644
--- a/src/Sylius/Abstraction/StateMachine/config/services.xml
+++ b/src/Sylius/Abstraction/StateMachine/config/services.xml
@@ -35,5 +35,10 @@
+
+
+
+
+
diff --git a/src/Sylius/Abstraction/StateMachine/src/Twig/StateMachineExtension.php b/src/Sylius/Abstraction/StateMachine/src/Twig/StateMachineExtension.php
new file mode 100644
index 00000000000..bd3c4f30385
--- /dev/null
+++ b/src/Sylius/Abstraction/StateMachine/src/Twig/StateMachineExtension.php
@@ -0,0 +1,33 @@
+stateMachine->can(...)),
+ new TwigFunction('sylius_sm_transitions', $this->stateMachine->getEnabledTransitions(...)),
+ ];
+ }
+}
diff --git a/src/Sylius/Bundle/AdminBundle/templates/order/show/content/header/title_block/actions/cancel.html.twig b/src/Sylius/Bundle/AdminBundle/templates/order/show/content/header/title_block/actions/cancel.html.twig
index 1ddd328968c..aef17c61cb6 100644
--- a/src/Sylius/Bundle/AdminBundle/templates/order/show/content/header/title_block/actions/cancel.html.twig
+++ b/src/Sylius/Bundle/AdminBundle/templates/order/show/content/header/title_block/actions/cancel.html.twig
@@ -1,6 +1,6 @@
{% set order = hookable_metadata.context.resource %}
-{% if sm_can(order, constant('Sylius\\Component\\Order\\OrderTransitions::TRANSITION_CANCEL'), constant('Sylius\\Component\\Order\\OrderTransitions::GRAPH')) %}
+{% if sylius_sm_can(order, constant('Sylius\\Component\\Order\\OrderTransitions::GRAPH'), constant('Sylius\\Component\\Order\\OrderTransitions::TRANSITION_CANCEL')) %}
{% from '@SyliusAdmin/shared/helper/icon.html.twig' import icon as icon %}