In a digital product marketplace, the files a buyer gets are attached to the order automatically. Only the buyer and seller can access them. By default, sellers can't change the shared file after the order is placed. Sometimes, however, the file uploaded to a listing might be wrong or the seller wants to update it and share the new version with a customer for free. For these cases, you can add an option to replace a file in a transaction.
Adding a replace option requires custom code and a small change to your transaction process, but you don't need to be a developer to do it. With AI-assisted coding, an AI tool like Claude writes the code from a plain-language description.
This article gives you a ready-made prompt to add file replacement to digital download orders. You customize a few details, paste it into your AI tool, and work from there. The AI will still ask you clarifying questions, and getting the result you want often takes a few rounds of feedback.
If you're new to AI-assisted coding (or vibecoding), start with these:
Before you start
This article assumes you've already completed the setup in How to start AI-assisted coding on top of Sharetribe for non-developers. You should have, at minimum:
A development environment in Console
A local copy of the Sharetribe Web Template running on your computer
The Claude desktop app (or another AI coding tool) with the Sharetribe Development Plugin installed
This feature also needs:
A listing type that uses the Digital download transaction process. This is the process for digital products. If you haven't set one up yet, do it in Console before you start.
The Sharetribe CLI, installed and logged in. The CLI is a command-line tool you use to deploy transaction process changes. If you haven't installed it, ask your AI can walk you through it. For more information, see Getting started with Sharetribe CLI.
The steps below use the Claude desktop app, but the same prompt should work in other AI coding tools as well.
Step 1: Decide the details
Before you prompt, decide how the feature should work in your marketplace. Answering these up front saves you a round or two of questions later.
Should the order's status change when files are replaced? Keeping the status the same is simplest. Changing it, for example to show that files were updated, takes more changes to the transaction process.
Should the buyer be notified about a file change? If yes, the buyer knows to download the new file. The AI will also need to add an email template for the notification.
Not sure yet? You can leave a detail out and the AI will ask you about it.
Step 2: Copy and customize the prompt
Copy the prompt below and replace the parts in [square brackets] with your answers to the questions above.
You can leave the rest as it is or modify it to better match your needs. The prompt tells the AI how the file replacement feature should work, which transaction process action to use, and points it to the right documentation.
I want sellers to be able to replace the files of a digital download order.If the buyer says or the seller notices the file is wrong, the seller should be able to delete the wrong file and upload the correct one in its place.
The feature has two parts:
1. "Replace files" button on the order page, shown only to the seller, under the order's files. Clicking it opens a popup that lists the current files, each with a Remove button, and has an "Add file" option for uploading a new file. Saving should only be possible once all uploads have finished and at least one file remains.
2. Saving the change: the buyer sees the new files on their order right away.
The order's status [stays the same/changes to something else]. The buyer [gets an email/is not notified] when files are replaced.
This needs a change to the default-download transaction process using the update-protected-files action. Ask me for approval before changing the process, and give me the exact commands to deploy it to the development environment, marketplace ID [yourmarketplace-dev], including updating the process alias.
Documentation:
- Files in Sharetribe: https://www.sharetribe.com/docs/concepts/files/files-in-sharetribe/
- Transaction process actions (see update-protected-files): https://www.sharetribe.com/docs/references/transaction-process-actions/
- Editing a transaction process: https://www.sharetribe.com/docs/how-to/transaction-process/change-transaction-process-in-template/
- Sharetribe CLI: https://www.sharetribe.com/docs/introduction/getting-started-with-sharetribe-cli/
Ask clarifying questions to improve the prompt if needed.
Step 3: Work through it with the AI
When you send the prompt, expect a conversation rather than a finished feature on the first try. This feature has three stages: the AI plans the process change, you approve it, and then you deploy it and test the page.
Approve the process change. The prompt asks the AI to stop and ask before it edits the transaction process. It will explain what it wants to add, usually a new transition that lets the seller update the order's files. If something is unclear, ask it to explain in plain language before you approve.
Deploy the process. After the change, the AI gives you CLI commands to run in your terminal. They push a new version of the process to your development environment and point the process alias to that version. Run them one at a time, and if a command fails, copy the error to the AI.
Once the AI has built the first version, open your local development marketplace and look at the result.
With Ask permissions mode on, Claude shows each change before making it. You don't need to understand every line of code, but check that the changes match what you asked for.
Step 4: Test the feature
AI output is never exactly the same twice. Even though this prompt has worked for us, your result may not work as expected on the first try. When you run into problems, tell the AI what's not working, share any errors you get, and it will try again. If you want to start over, you can also ask it to undo its changes.
Test with a new order placed after you deploy the process. Orders placed earlier stay on the previous process version, so the Replace files button won't work on them.
As you test, tell the AI what to change, one thing at a time. For example:
"The Replace files button looks like a link. Make it a secondary button."
"Show a warning in the popup that the buyer will see the new files right away."
"The Save button stays disabled after the upload finishes. Fix it."
Here's a suggested testing checklist:
Place a new digital download order as a buyer.
Open the order as the seller. Check that the Replace files button appears under the order's files.
Open the same order as the buyer. Check that the button doesn't appear.
As the seller, open the popup, remove a file, and add a new one. Check that Save stays disabled while the upload is in progress.
Remove every file. Check that you can't save.
Save the change, then open the order as the buyer. Check that the new file shows and downloads, and the old one is gone.
Check that the order's status matches what you decided in Step 1.
If you chose to notify the buyer, check that the email arrives. If not, check that no email is sent.
Find the transaction in Console and check that it shows the new files.
Repeat the seller and buyer checks on a mobile screen.
If you plan to go live with this feature, you also need to deploy the process change to your live environment. Consider having a Sharetribe Expert review the code and the process change before you do. Changes to orders and files buyers have paid for are a good case for a professional review.
What to build next
You can use private files and protected transaction files for other workflows too. Here are a couple of tutorials for custom features that use files:
Collect a private file at signup, like a license or proof of insurance
Add reusable files that users can share in any transaction, like a price list
Or create something different, like ask a provider for proof of delivery before payout, or ask a customer to sign a contract before a transaction moves forward.
For the technical details behind these features, see private files and protected files in our developer docs.
