Write theme file
ps_write_theme_file
Changes a file of your shop's look, with a backup made first.
TellMyShop Free: No. This tool is only in TellMyShop Pro. TellMyShop Free has only ready reports that read your store.
Ask Claude
„Add a line "Free delivery over 250 PLN" under the price on the product page.”
Example preview
templates/catalog/_partials/product-prices.tpl
@@ line 88 @@
{/block}
+ <p class="free-delivery">{l s='Free delivery over 250 PLN' d='Shop.Theme.Catalog'}</p>
Smarty validation: OK. New scripts: none. Backup will be created before saving.Technical details
Changes a file of the ACTIVE theme (.tpl, .css, .js, .json): replaces a fragment (search -> replace; the fragment must appear exactly once) or writes the whole content (content, also a new file such as assets/css/custom.css). Small visual fixes are best done in assets/css/custom.css and assets/js/custom.js, which PrestaShop loads on every page. Before saving: validation (Smarty: allowed tags and modifiers only, plus compilation; JSON: syntax), warnings about new scripts and external domains, automatic backup. For module template overrides use ps_override_module_template. Saving needs the Theme switch.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| path | string | yes | Path in the active theme, for example templates/catalog/product.tpl. Max 300 characters. |
| search | string | no | Exact fragment to replace (with whitespace, as in the file). Max 100,000 characters. |
| replace | string | no | New fragment (together with search). Max 100,000 characters. |
| content | string | no | Whole new file content (instead of search/replace). Max 500,000 characters. |
| confirm | boolean | no | false (default) returns a preview and saves nothing. true executes, only after the user approved the preview, together with change_token. |
| change_token | string | when: confirm=true | Token from the preview. Required with confirm=true. Valid 30 minutes, single use, bound to the previewed arguments and data state. |
Limits
20 file writes per hour, shared by all file tools (adjustable in the Settings: security, alerts, limits card). Active theme only; the parent theme is read-only. Extensions .tpl, .css, .js, .json. After saving: ps_clear_cache and ps_inspect_page.
What you see before anything is saved
Claude first calls the tool without confirming it. The module returns a preview (current and new values) and a single-use token valid for 30 minutes. Claude shows you the preview and saves the change only after your yes.
Related tools
- Read theme file ps_read_theme_file
- List file backups ps_list_file_backups
- Restore file backup ps_restore_file_backup
- Clear cache ps_clear_cache
- Inspect a store page ps_inspect_page
Use cases with this tool
- Change the colour of the add-to-cart button
- Add delivery and returns info under the price
- Add a site-wide announcement bar
- Swap the homepage banner for a seasonal campaign
- Remove doubled product information that confuses Google
- Hide or tidy an element on mobile
- Add a site verification code to every page
- Change how an add-on looks without losing it on the next update
- Change a fixed text in an add-on's box
- Restyle the featured products block on the homepage
- Fix headings and image descriptions in the homepage slider
- Try risky changes on a test copy of the shop first
Last updated: 2026-10-11