Write theme file

ps_write_theme_file

Write · preview + approveBlock 3 · Appearance & deployments (service connector, off by default)Service connector onlyBlock off after install

Changes a file of your shop's look, with a backup made first.

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). 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. Service connector only (allowlisted IP addresses).

Parameters

NameTypeRequiredDescription
pathstringyesPath in the active theme, for example templates/catalog/product.tpl (max 300).
searchstringnoExact fragment to replace, with whitespace as in the file (max 100,000). Must appear exactly once.
replacestringnoNew fragment, with search (max 100,000).
contentstringnoWhole new file content instead of search/replace (max 500,000).
confirmbooleannofalse (default) returns a preview and saves nothing. true executes, only after the user approved the preview, together with change_token.
change_tokenstringwhen: confirm=trueToken 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. 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

Last updated: 2026-10-03