Cart page integration
On the cart page (and in AJAX cart drawers) the frontend does two things:
- Replace line item thumbnails with the customized preview image.
- Rewrite product links into edit links so the customer can re-open their design.
Both rely on the line item properties written at add-to-cart, so this page also documents those.
Line item properties
Every customized line item carries a set of properties. Keys prefixed with _ are hidden by Shopify in cart, checkout, and notification emails; keys without the prefix are shown to the customer.
| Property | Visible | Contents |
|---|---|---|
_fpd-hash | no | Identifier of the server-side line item cache (LIC) — the stored design. Everything else (edit, preview, print files) is looked up through this hash. |
_fpd-url | no | URL of the preview image of the customized design. Used to swap the cart thumbnail. |
_fpd-handle | no | Handle of the original Shopify product. Used to build the edit link. |
_fpd-variant-id | no | The originally selected real variant ID. Present when the cart line uses a generated custom variant, so the edit link can restore the customer's real size/color selection. |
_fpd_print_pdf | no | Direct URL to the print-ready PDF. Only written when the shop option shopify_link_print_pdf is enabled. |
_fpd-asset-0, _fpd-asset-1, … | no | Source URLs of each customer-uploaded image, one property per image. Only written when shopify_link_assets is enabled. |
Custom Texts | yes | Number of customized text elements. Suppressed via shopify_no_text_count. |
Custom Images | yes | Number of customized image elements. Suppressed via shopify_no_image_count. |
_fpd* propertiesEverything prefixed with _fpd belongs to the designer integration. If your theme or another app rewrites line item properties, it must pass all _fpd* keys through unchanged (filter by prefix, not by a fixed key list). Removing them breaks thumbnails, editing, and — worst case — order fulfillment.
Where the design itself lives
The design data is not stored in the properties. At add-to-cart the full design (all views and elements), print data, and a preview image are uploaded to the FPD backend as a line item cache record; the cart line only carries the _fpd-hash reference. This keeps carts small and makes designs survive across devices and sessions.
Thumbnail replacement
On the cart page the frontend fetches /cart.js, walks your cart rows, and swaps each customized item's image for its _fpd-url preview.
For this to work your cart markup must line up with three configurable selectors (see Configuration for how these are set per shop):
| Purpose | Option | Default selector |
|---|---|---|
| Cart form/container | shopify_ta_cart_page_form | form[action='/cart'] |
| One line item row | shopify_ta_cart_page_row | (must be set per theme, e.g. .cart-item) |
| Image inside a row | shopify_ta_cart_page_row_image | .fpd-item-image |
Two rules your theme must follow:
- Row order must match
/cart.jsorder. Items are matched to DOM rows by index, not by ID. If your theme renders cart rows in a different order than Shopify's cart JSON, wrong images will be swapped. - The image target should be an
<img>or<a>. For<img>bothsrcandsrcsetare replaced; for<a>thehref(and a CSSbackground-image, if present) is updated. If the matched element is neither, a new<img>is appended into it as a fallback.
When the customer changes the cart, the frontend detects calls to /cart/change and /cart/update, refreshes its cart data, and re-runs the replacement automatically. It also watches the cart form's DOM: whenever the theme renders line items into it (or resets a link inside one), images and links are written again.
Edit links
For each customized line item the frontend builds an edit URL:
https://<shop>/products/<_fpd-handle>?variant=<variant>&_fpd-hash=<hash>&li-key=<line item key>
variantprefers_fpd-variant-id(the customer's real selection) over the line's variant._fpd-hashtells the product page which stored design to load.li-keyis the Shopify cart line key, used to replace the existing line instead of adding a second one when the customer saves their edit.
Behavior is controlled by two options:
shopify_cart_link_edit(default on) — existing product links inside the row are rewritten to the edit URL. When off, they are rewritten to the original product page (/products/<_fpd-handle>?variant=<variant>) instead.shopify_add_edit_link(default on) — an extra<a class="fpd-edit-button">Edit</a>is appended to the element matchingshopify_ta_cart_page_row_attach(default.product-option:last-child). Style it via thefpd-edit-buttonclass.
Either way the links never stay on the line item's own URL. With an extra price the line item is a hidden bundle product, and a bundle bought from its own product page carries no _fpd-* properties, which breaks the pricing of every bundle line in the cart. Every link in the row that leads to the line's product is rewritten — image and title, with or without the variant param. A bundle line without _fpd-handle (legacy cart data) is linked to /variants/<_fpd-variant-id>, which Shopify redirects to the original product; the redirect drops the query string, so such a link cannot open the design for editing.
What happens on the product page when an edit link is opened is described in Product page.
AJAX carts and cart drawers
Outside the cart page a general handler runs on every page and performs the same thumbnail/link updates for JS-rendered carts (drawers, mini carts). It uses its own selector set:
| Purpose | Option | Default |
|---|---|---|
| Cart drawer element | shopify_ta_cart_js_cart_drawer | cart-drawer |
| Cart container | shopify_ta_cart_js_element | form[action='/cart'] |
| One line item | shopify_ta_cart_js_item | .cart-drawer__item |
| Item image | shopify_ta_cart_js_image | .cart-drawer__item-image |
The frontend watches the cart container's DOM: whenever line items are rendered into it (quantity change, an app adding a line, a section reload) or a link inside one is reset, it reloads /cart.js and re-runs the image and link updates. Two hooks remain for re-renders it cannot see, e.g. a drawer that only swaps image sources:
-
Event
fpd:cartChanged— the frontend listens for this ondocumentand re-runs image and link updates:document.dispatchEvent(new CustomEvent('fpd:cartChanged')); -
FPD.func.updateCartJSImages()— imperative alternative for the images only; call it after your drawer finished rendering.
After the designer's own add-to-cart (JSON strategy), the frontend already triggers the drawer refresh itself, including Shopify Section Rendering (sections / sections_url) and calling renderContents() + open() on the drawer element.
Product links in JS carts follow the same rules as on the cart page (Edit links): the edit URL including li-key with shopify_cart_link_edit, the original product page without it.
Bulk orders
When the bulk order form is active (a #fpd-bulk-order-container element exists on the product page), all selected variant/quantity combinations are added in a single /cart/add.js call and share one line item cache: every resulting line carries the same _fpd-hash, _fpd-url, and related properties.