Shopify auto-fulifll
Sun Feb 12 2023 18:59:07 GMT+0000 (UTC)
Saved by
@PIzmAR
// Get the product ID of the product you want to auto-fulfill
var productId = 123456789;
// Listen for the checkout.order.completed event
$(document).on('checkout.order.completed', function(event, data) {
// Get the array of items in the order
var items = data.items;
// Loop through the items in the order
for (var i = 0; i < items.length; i++) {
// Check if the item is the product you want to auto-fulfill
if (items[i].product_id == productId) {
// Fulfill the item
var itemId = items[i].id;
var fulfillUrl = '/admin/orders/' + data.order_id + '/fulfillments/new?fulfillment[line_items][]=' + itemId;
window.location.href = fulfillUrl;
}
}
});
content_copyCOPY
Here is an example of a JavaScript code that could be used to auto-fulfill a specific product in an order when it's checked out on Shopify:
javascript
Copy code
Note that this is just an example and you may need to make some modifications to fit your specific use case. Also, keep in mind that you would need to add this code to your Shopify theme or use an app to integrate it with your Shopify store.
Regenerate response
https://chat.openai.com/chat
Comments