Skip to content

Add document previews to a product

Document previews are configured per product.

On the product edit screen, the “Document previews” meta box holds a table of documents. Each row has:

  • Document Name, the label shown on the preview button.
  • File URL or Sharing Link, a file URL or a cloud sharing link.
  • Upload File, a Choose File button that opens the Media Library.

Use Add to append a row and Remove to delete one. Rows can be reordered by dragging the sort handle. A collapsed “What can I add here?” note lists the accepted file types and link types.

  • A document needs both a name and a URL. A row missing either is reported and not saved.
  • A file type or link the plugin cannot preview is rejected with a message rather than saved silently.
  • Removing every row and updating the product clears all documents for that product.
  • Saving the product from a screen that never showed the meta box (for example a quick edit) leaves existing documents untouched.

If the site is detected as local or not reachable from the internet, the meta box shows a notice to the store owner. PDFs still preview because they render on your own server. Word, Excel, and PowerPoint previews stay blank until the site is publicly reachable, because their viewer has to fetch the file. The notice is shown only to the owner on the edit screen, never to shoppers.

Documents are stored in a single product meta row under the wcdp_documents key, as parallel name and URL arrays. The same data is exposed through the admin Documents list, the REST API, and the CSV export.