type Shopify = {
token: string;
store_name: string;
};
/**
* Delete a product listing to unpublish a product from your app
* Delete a product listing to unpublish a product from your app
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
product_listing_id: string
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/product_listings/${product_listing_id}.json`
);
const response = await fetch(url, {
method: "DELETE",
headers: {
"X-Shopify-Access-Token": auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 337 days ago
type Shopify = {
token: string;
store_name: string;
};
/**
* Delete a product listing to unpublish a product from your app
* Delete a product listing to unpublish a product from your app
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
product_listing_id: string
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/product_listings/${product_listing_id}.json`
);
const response = await fetch(url, {
method: "DELETE",
headers: {
"X-Shopify-Access-Token": auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 883 days ago