MerchantDrafts · Docs

Writing Pattern and Product Emphasis

How writing style and product emphasis are configured.

Overview

Two prompt layers give operators control over generated copy tone and focus without requiring them to write prompts:

Both operate inside the Business Context baseline, which always dominates.

For core product content there is now one additional middle layer:

Writing Pattern

Storage: mdrfts_custom_writing_pattern (WordPress option)

Read by: mdrfts_get_custom_writing_pattern()

Location: Settings → Brand tab → Writing Pattern card

Scope: Store-level only. One pattern applies to all products.

Operators write in plain language: what to lead with, what angle to take, what to avoid. Examples:

UI — Button Map

ButtonTypeWhat it does
Suggest from Business ContextPrimary (blue), left-alignedCalls Gemini with saved Business Context → generates 2–4 sentence writing pattern → auto-saves to DB → fills textarea
Save Manual EditsSecondary, right-alignedSubmits the form — persists any manual text edits to the textarea
Copy icon (dashicons-clipboard)Icon overlay, top-right of textareaCopies textarea content to clipboard; switches to dashicons-yes for 2 s then reverts
Trash icon (dashicons-trash)Icon overlay, top-right of textarea; only visible when a value existsClears writing pattern (separate hidden form with confirm dialog)

The icon toolbar uses the same .mdrfts-ta-toolbar pattern as Business Context — fades in on hover/focus-within.

Loading Feedback

During a Suggest operation the button shows an inline spinner (dashicons-update + mdrfts-spin) and its label changes to "Generating…". The status paragraph above the button row:

A live word count (<span id="mdrfts-wp-wordcount">) is shown below the textarea in soft grey.

Auto-save behaviour

When a suggestion is returned, it is immediately saved to the database via a second AJAX call (mdrfts_save_writing_pattern) before the success message is shown. This mirrors Business Context auto-save. Save Manual Edits is available for any subsequent manual edits.

AI suggestion requirements: Business Context must be set and Gemini access must be available (hosted or BYOK).

Injection: Injected into the prompt between Business Context and Product Emphasis. Empty = skipped safely.

Auto-height textarea

field-sizing: content with resize: none; overflow: hidden; min-height: 80px; padding: 36px; font-size: 11px; line-height: 1.4 (inline styles). JS fallback mdrftsResizePattern() mirrors the Business Context approach.

Product Emphasis ("What to emphasize")

Storage: _mdrfts_custom_instructions (post meta)

Location: Product editor controls pane, above Tone and Description Length

Scope: Per-product.

Operators write raw intent: what to highlight for this specific product. Input is treated as operator intent, not a literal prompt instruction. The engine interprets it within the Business Context baseline — conservative enrichment only; angles not implied by the operator's input are not introduced.

Auto-save: Input is auto-saved via AJAX (800ms debounce) with inline Saved / Save failed feedback. No manual save step required.

Info tab display: After generation, a deterministic "Emphasized:" line appears in the Info tab confirming what was applied. JS-side normalization strips filler openers and normalizes phrases — no AI call involved.

Workspace role

Product Emphasis is not only a core-content helper. In the workspace architecture it is the Product Custom Instructions layer.

This means the same field should be interpreted as the per-product instruction layer for:

It should stay distinct from:

Active Layer Indicators

Info tab (post-generation)

After every generation the Info tab shows an Active layers row:

These are read from mdrfts_ajax.business_context, mdrfts_ajax.writing_pattern, and mdrfts_ajax.effective_category_context passed at page load.

Controls sidebar (pre-generation)

Inside Advanced Options (below the checkboxes), three status rows are always visible:

Business Context and Writing Pattern are rendered from saved options. Category Context is rendered from the effective per-product category lookup. Together they give the operator a quick at-a-glance check before generating.

Precedence Rules

Design Decisions

DEC-008 — Baseline + focus prompt model. Business Context = the room, Product Emphasis = the corner of the room to stand in. Prompt framing encodes hierarchy so no extra validation layer is needed.

DEC-009 — Built-in presets abandoned. A "Technical" preset overlapped with the Tone dropdown; "Gift & Occasion" was not universal across store types. Replaced with a single store-level free-text Writing Pattern field that operators define for their own context.