Sends a fulfillment email to a specified custom fulfiller of a line item in a given order.
The sendFulfillmentEmail()
function returns a Promise that is resolved when the fulfillment email for the specified order is sent to the specified custom fulfiller.
A custom fulfiller is a fulfiller that is not integrated with the Wix App Market.
Learn more about Connecting Your Wix Store to a Fulfillment Service.
function sendFulfillmentEmail(
orderId: string,
fulfillerId: string,
): Promise<void>;
ID of the order for fulfillment.
ID of the custom fulfiller.
/***********************************
* Backend code - fulfillments.jsw *
***********************************/
import wixStoresBackend from "wix-stores-backend";
export function sendFulfillmentEmail(orderId, fulfillerId) {
return wixStoresBackend.sendFulfillmentEmail(orderId, fulfillerId);
}
/**************
* Page code *
**************/
import { sendFulfillmentEmail } from "backend/fulfillments";
export function button1_click(event) {
$w("#thankYouPage1")
.getOrder()
.then((order) => {
sendFulfillmentEmail(order._id, order.lineItems[0].fulfillerId)
.then(() => {
// Fulfillment email sent
})
.catch((error) => {
// Fulfillment email not sent
console.log(error);
});
});
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.