How to make button Buy Now with add to cart for opencart 2X ?

For opencart 2.0 Add extra button beside Add to cart button i.e., Buy Now Or you can add option in admin which product have to be buy now or add to cart button

for category page \catalog\view\theme\default\template\product\category.tpl And same for modules

<button type="button" onclick="buynow('<?php echo $product['product_id']; ?>');">
     <i class="fa"></i> 
     <span class="hidden-xs hidden-sm hidden-md">Buy Now</span>
     <script>function buynow(pid){cart.add_buynow(pid);}</script>

for product page \catalog\view\theme\default\template\product\product.tpl

<button type="button" id="button_buy" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary btn-lg btn-block">Buy Now</button>

    url: 'index.php?route=checkout/cart/add',
    type: 'post',
    data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
    dataType: 'json',
    beforeSend: function() {
    complete: function() {
    success: function(json) {


      if (json['error']) {
        if (json['error']['option']) {
          for (i in json['error']['option']) {
            var element = $('#input-option' + i.replace('_', '-'));

            if (element.parent().hasClass('input-group')) {
              element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
            } else {
              element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>');

        if (json['error']['recurring']) {
          $('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>');

        // Highlight any found errors

      if (json['success']) {location.href = 'index.php?route=checkout/checkout';  }

if oc 2.3 X added below code

to file opencart/upload/catalog/view/javascript/common.js line 168.

and it worked like charm.

ref :