Search.../

getPackingSlipLink( )

Generates a link to a PDF file containing an order's packing slip.

Description

The getPackingSlipLink() function returns a Promise that resolves to an object containing the URL of a PDF file with the specified order's packing slip.

Syntax

function getPackingSlipLink(orderId: string): LinkToPdf

getPackingSlipLink Parameters

NAME
TYPE
DESCRIPTION
orderId

string

ID of the order for which to generate a packing slip.

Returns

Fulfilled - URL to a PDF file. Rejected - Error message.

Return Type:

Promise<LinkToPdf>

Related Content:

Was this helpful?

Get a PDF file containing an order's packing slip

Code Example

Copy Code
1/*******************************
2 * Backend code - orders.jsw *
3 *******************************/
4
5import wixStoresBackend from 'wix-stores-backend';
6
7export function getPackingSlipLink(orderId) {
8 return wixStoresBackend.getPackingSlipLink(orderId);
9}
10
11
12/**************
13 * Page code *
14 **************/
15
16import { getPackingSlipLink } from 'backend/orders';
17import wixData from 'wix-data';
18
19// Find the ID of the most recent order
20wixData.query('Stores/Orders')
21 .descending('_dateCreated')
22 .find()
23 .then((results) => {
24
25 let orderId = results.items[0]._id;
26
27 getPackingSlipLink(orderId)
28 .then((url) => {
29 const packingSlipUrl = url;
30 })
31 .catch((error) => {
32 console.log(error);
33 });
34 });
35
36/* Example packingSlipUrl:
37*
38* {
39* link: "https://wixmp-2a4e9...a5977f91b.appspot.com/_api/download/file?downloadToken=eyJ...jwAc"
40* }
41*
42*/
Get a PDF file with an order packing slip from the Thank You Page

Code Example

Copy Code
1/*******************************
2 * Backend code - orders.jsw *
3 *******************************/
4
5import wixStoresBackend from 'wix-stores-backend';
6
7export function getPackingSlipLink(orderId) {
8 return wixStoresBackend.getPackingSlipLink(orderId);
9}
10
11
12/**************
13 * Page code *
14 **************/
15
16import { getPackingSlipLink } from 'backend/orders';
17
18export function buttonPrintPackingSlip_click(event) {
19 $w('#myThankYouPage').getOrder()
20 .then((order) => {
21 getPackingSlipLink(order._id)
22 .then((url) => {
23 const packingSlipUrl = url;
24 })
25 .catch((error) => {
26 console.log(error);
27 });
28 });
29}
30
31/* Example packingSlipUrl:
32*
33* {
34* link: "https://wixmp-2a4e9...a5977f91b.appspot.com/_api/download/file?downloadToken=eyJ...jwAc"
35* }
36*
37*/