本文介绍了Shopify API:如何向客户发送有关正在发货的产品的电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过更新订单履行向客户发送一封包含订单跟踪信息的电子邮件,但该电子邮件未发出。我可以检索履行并添加跟踪代码,它会正确保存,但状态不会更新。

 fulfillment_id = 3252574519475
 shopify_order_id = 3683332686003

 fulfillment = shopify.Fulfillment.find(fulfillment_id,order_id=shopify_order_id)
 fulfillment.tracking_numbers = [tracking_number]
 fulfillment.tracking_company = tracking_company
 fulfillment.notify_customer = "true"
 fulfillment.status = "success"
 fulfillment.shipment_status = "delivered"
 result = fulfillment.save()

当我访问https://dev-store.myshopify.com/admin/orders/3683332686003/fulfillments.json时,我看到tracking_numbers更新以及tracking_companytracking_urls,但状态仍然是open

 {
    "fulfillments": [{
        "id": 3252573110451,
        "order_id": 3683332686003,
        "status": "success",
        "created_at": "2021-03-22T14:36:55-04:00",
        "service": "gift_card",
        "updated_at": "2021-03-22T14:36:56-04:00",
        "tracking_company": null,
        "shipment_status": null,
        "location_id": 61514940595,
        "line_items": [{
            "id": 9689309610163,
            "variant_id": 39396209983667,
            "title": "$100 ta E-Gift Card",
            "quantity": 1,
            "sku": null,
            "variant_title": "$100.00 USD",
            "vendor": "A",
            "fulfillment_service": "gift_card",
            "product_id": 6571217256627,
            "requires_shipping": false,
            "taxable": false,
            "gift_card": true,
            "name": "$100 ta E-Gift Card - $100.00 USD",
            "variant_inventory_management": null,
            "properties": [],
            "product_exists": true,
            "fulfillable_quantity": 0,
            "grams": 0,
            "price": "95.00",
            "total_discount": "0.00",
            "fulfillment_status": "fulfilled",
            "price_set": {
                "shop_money": {
                    "amount": "95.00",
                    "currency_code": "USD"
                },
                "presentment_money": {
                    "amount": "95.00",
                    "currency_code": "USD"
                }
            },
            "total_discount_set": {
                "shop_money": {
                    "amount": "0.00",
                    "currency_code": "USD"
                },
                "presentment_money": {
                    "amount": "0.00",
                    "currency_code": "USD"
                }
            },
            "discount_allocations": [],
            "tax_lines": []
        }],
        "tracking_number": null,
        "tracking_numbers": [],
        "tracking_url": null,
        "tracking_urls": [],
        "receipt": {
            "gift_cards": [{
                "id": 483988799667,
                "line_item_id": 9689309610163,
                "masked_code": "•••• •••• •••• 74e2"
            }]
        },
        "name": "#1013.1"
    }, {
        "id": 3252574519475,
        "order_id": 3683332686003,
        "status": "open",
        "created_at": "2021-03-22T14:37:23-04:00",
        "service": "manual",
        "updated_at": "2021-03-22T14:49:45-04:00",
        "tracking_company": "UPS",
        "shipment_status": null,
        "location_id": 61514940595,
        "line_items": [{
            "id": 9689309642931,
            "variant_id": 39396224663731,
            "title": "The Pack",
            "quantity": 1,
            "sku": "FM-001",
            "variant_title": null,
            "vendor": "A",
            "fulfillment_service": "manual",
            "product_id": 6571220402355,
            "requires_shipping": true,
            "taxable": true,
            "gift_card": false,
            "name": "The Pack",
            "variant_inventory_management": null,
            "properties": [],
            "product_exists": true,
            "fulfillable_quantity": 0,
            "grams": 3629,
            "price": "111.99",
            "total_discount": "0.00",
            "fulfillment_status": null,
            "price_set": {
                "shop_money": {
                    "amount": "111.99",
                    "currency_code": "USD"
                },
                "presentment_money": {
                    "amount": "111.99",
                    "currency_code": "USD"
                }
            },
            "total_discount_set": {
                "shop_money": {
                    "amount": "0.00",
                    "currency_code": "USD"
                },
                "presentment_money": {
                    "amount": "0.00",
                    "currency_code": "USD"
                }
            },
            "discount_allocations": [],
            "tax_lines": []
        }],
        "tracking_number": "1Z6R96W802851935",
        "tracking_numbers": ["1Z6R96W802851935"],
        "tracking_url": "https://www.ups.com/WebTracking?loc=en_USu0026requester=STu0026trackNums=1Z6R96W80302851935",
        "tracking_urls": ["https://www.ups.com/WebTracking?loc=en_USu0026requester=STu0026trackNums=1Z6R96W80302851935"],
        "receipt": {},
        "name": "#1013.2"
    }]
 }

如何让Shopify向客户发送包含跟踪编号的电子邮件,并将履行状态从open更新为success,以便将整个订单设置为已履行?我一直在商店手动创建订单,我不确定这是否与此有关。

我正在使用此Python包https://github.com/Shopify/shopify_python_api

推荐答案

如果您在执行时将";NOTIFY_CUSTOMER&QOOT;设置为TRUE,这是第一件事。然后,您应该创建一个所谓的Fullfulment事件,并将";status";设置为";In_TRANSPORT&QOT;。因此,Shopify将:

  • 向客户发送电子邮件
  • 将履行状态设置为";在途(&Q;)
  • 在订单状态页上显示新状态
Shopify的API文档中很好地描述了履行事件的创建,网址为:https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillmentevent

在履行事件的帮助下,您还可以设置更多状态值,如";out_for_Delivery";和";Delivered&Quot;。

这篇关于Shopify API:如何向客户发送有关正在发货的产品的电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-15 12:21