Add file upload option to checkout page
In this tutorial we show you how to add a file upload option to your checkout page that will send files to your Uploadcare account.
In this article
Configure Uploadcare Widget
- Create your free Uploadcare account here.
- Create you first Project in Uploadcare here.
- Configure your widget here.
Add Widget to Checkout Page
- In the Foxy admin, go to your Configuration page here.
- Under the "Cart" section turn on the "Add custom header and footer code to your templates" option.
Go back to the Uploadcare Widget page and copy the script snippet. It will look similar to the following:
<script> UPLOADCARE_PUBLIC_KEY = "CHANGE_TO_YOUR_PUBLIC_KEY"; </script> <script charset="utf-8" src="//ucarecdn.com/widget/2.9.0/uploadcare/uploadcare.full.min.js"></script>
- In the Foxy admin, paste the snippet you just copied into the "Custom Header" textarea.
- On the same page, under the "Checkout" section, turn on the "Add custom form fields to your checkout" option.
Paste the following HTML into the textarea:
<div class="fc-form-group "> <div class="col-sm-8 col-sm-offset-3"> <div class="fc-input-group-container fc-input-group-container--checkbox fc-input-group-container--active"> <label class="fc-input-group-container__title fc-input-group-container__title--forced fc-form-label"> Upload Files </label> <div class="fc-form-group"> <p>Click below to upload your image files.</p> PASTE INPUT FIELD HTML HERE </div> </div> </div> </div>
- On the Uploadcare Widget page, copy the form input HTML.
- Go back to the Foxy Confirguration page and replace "PASTE INPUT FIELD HTML HERE" with the HTML you just copied.
- Add the "name" parameter to the input HTML (ie: name="uploads") The name value can be changed to anything you want.
- Save your Configurations changes.
If everything has been setup correctly, customers will see a new section on the checkout page where they can click to upload their files. Just like everything else in Foxy, the upload button and surrounding elements can be customized and styled with custom HTML and CSS.
Accessing Uploaded Files
A link to uploaded file(s) will be available in the receipt (both web and email) along with transaction details in the Foxy admin here.