Skip to main content
Here, you will find all the parameters, events and methods on the PrintAppClient class. You can find a basic installation guide here. This is how to initialize a PrintAppClient:

Parameters

Methods

Event types

Events are attached to the PrintAppClient after initialization using the addEventListener method.

The app:saved payload

Your listener receives an event whose data describes the saved project:
The event comes from the customer’s browser, so its contents are the customer’s to change. Before you fulfil an order, verify the projectId from your server: see Verify a project before fulfilling.

Adding to the cart on save

With Add to Cart on Save turned on in a design’s settings, the client presses the store’s Add to Cart button for the customer after the project is saved. It waits for every app:saved listener to finish first, so the project can be attached to the cart line before the add. A listener that does asynchronous work (posting the project to your server, say) must return its promise, or the add can happen before that work is done:
If your cart needs something other than a button press, take the add over. Just before it presses the button, the client dispatches a cancelable printapp:addtocart event on document. Call preventDefault() and do the add yourself:
You can add this script to your store from the Custom JavaScript input in your store settings. If the client cannot find your Add to Cart button, set the Cart button selector in your store settings.

Checking how far the editor got

The editor loads in steps: the client fetches your store settings, adds the editor’s frame to the page, the frame loads, the editor sends its first message to your page, the client sends it your parameters, the editor validates with our servers, and then it is ready. When app:ready doesn’t arrive, getBootStatus() tells you which step it stopped at:
The status holds counts and timings only, never your keys, settings or message contents, so you can log it or send it to us as it is. When a step takes longer than 10 seconds, stalled says which one, and the client logs a warning in the console: The other fields:

Loading the editor without a designId

This feature allows you to initilize the editor without having an prior design, by describing a design template. The parameter to pass unto the editor is an object titled designTemplate A sample value is shown in the code below with detailed comments.