See this extension:
https://www.opencart.com/index.php?rout ... n_id=24063 . Since you're using v3.x releases, in the XML file from that OCMod extension, change:
Code: Select all
<file path="catalog/view/theme/*/template/common/success.tpl">
<operation>
<search><![CDATA[
<?php echo $text_message; ?>
]]></search>
<add position="before"><![CDATA[
<!-- MIT : Order Id-->
<?php if(isset($text_order_id)) { ?>
<p><strong><?php echo $text_order_id;?></strong></p>
<?php } ?>
<!-- MIT : Order Id END-->
]]></add>
</operation>
</file>
To:
Code: Select all
<file path="catalog/view/theme/*/template/common/success.twig">
<operation>
<search><![CDATA[
{{ text_message }}
]]></search>
<add position="before"><![CDATA[
{% if (text_order_id) %}
<p><strong>{{ text_order_id }}</strong></p>
{% endif %}
]]></add>
</operation>
</file>
In your case, afterwards, you could simply replace this variable:
<p><strong>{{ text_order_id }}</strong></p>
with your JS code above.