How to Show Order Details on Checkout Success Page in Opencart 2x
<p>I am trying to show order details for successful orders on success page but unable to do so. Another answer here suggests to modify success.php and success.tpl but it's not working on Opencart 2.</p>

<p>What have I tried?</p>

<p>catalog/controller/checkout/success.php</p>

<p>and added new lines in the following code:</p>

<pre><code>public function index() {
$this-&gt;data['order_id'] = 0; // &lt;-- NEW LINE
$this-&gt;data['total'] = 0; // &lt;-- NEW LINE

if (isset($this-&gt;session-&gt;data['order_id'])) {
    $this-&gt;data['order_id'] = $this-&gt;session-&gt;data['order_id']; // &lt;-- NEW LINE
    $this-&gt;data['total'] = $this-&gt;cart-&gt;getTotal(); // &lt;-- NEW LINE

    $this-&gt;cart-&gt;clear();

    unset($this-&gt;session-&gt;data['shipping_method']);
    unset($this-&gt;session-&gt;data['shipping_methods']);
    unset($this-&gt;session-&gt;data['payment_method']);
    unset($this-&gt;session-&gt;data['payment_methods']);
    unset($this-&gt;session-&gt;data['guest']);
    unset($this-&gt;session-&gt;data['comment']);
    unset($this-&gt;session-&gt;data['order_id']);    
    unset($this-&gt;session-&gt;data['coupon']);
    unset($this-&gt;session-&gt;data['reward']);
    unset($this-&gt;session-&gt;data['voucher']);
    unset($this-&gt;session-&gt;data['vouchers']);
}   

$this-&gt;language-&gt;load('checkout/success');
</code></pre>

<p>Now added the following code into success.tpl</p>

<pre><code>&lt;?php if($order_id) { ?&gt;
&lt;script type="text/javascript"&gt;
// Some code here
arr.push([
    "create_order",
    {order_id: '&lt;?php echo $order_id; ?&gt;', sum: '&lt;?php echo $total; ?&gt;'}
]);
</code></pre>

<p></p>



<p>But it doesn't show anything on success page. The above code is to show order ID and total but I want to show all details of order including name, address, products, total, shipping, etc. Just like in the order invoice.</p>

<p>Any help will be appreciated. Thank you</p>