How to add a "click to copy code" button to the Redeem Link page
To help your users to copy their unique code on the Redeem Link landing page, you can use a bit of custom javascript to add a "copy code" button to the page that will copy the code to the user's clipboard. Modify this code to your needs.
At the top of the page message, add the following javascript code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script> <script> var c = new ClipboardJS('.btn-copy'); c.on('success', function () { $('.btn-copy').text('Copied!'); }) </script>
Then, add the following code where you wish to place the copy button:
<button class="btn btn-default btn-copy" type="button" data-clipboard-text="{{ code }}"> Copy Code </button>
This is how it would look like when the code is added to the redeem link page message: