admin管理员组文章数量:1336563
I am migrating a Shopify store to the Woocommerce store and using the REST API for migration of the data. I imported the customer and order data. But now facing issues with importing the order specifically with the date on which this order was placed. I am trying to pass the same date on which the order was placed. So this was my payload:
order_data = {
"customer_id": customer_id,
"status": order_status,
"date_created": order_date,
"billing": billing_data,
"shipping": shipping_data,
"line_items": line_items,
"shipping_total": str(shipping_total),
"payment_method": payment_method,
"shipping_lines": [
{
"method_title": shipping_method,
"method_id": shipping_method
}
] if shipping_method else [],
"meta_data": [
{"key": "_order_number", "value": str(order_id)},
{"key": "tracking_number", "value": tracking_number}
]
}
I looked at the Woocommerce rest API doc and it's mentioned that the created date and modified date are read-only so I tried to pass the date as meta_data:
# Payload
order_data = {
"customer_id": customer_id,
"status": order_status,
"billing": billing_data,
"shipping": shipping_data,
"line_items": line_items,
"shipping_total": str(shipping_total),
"payment_method": payment_method,
"payment_method_title": payment_method,
"shipping_lines": [
{
"method_title": shipping_method,
"method_id": shipping_method
}
] if shipping_method else [],
"meta_data": [
{"key": "_order_number", "value": str(order_id)},
{"key": "tracking_number", "value": tracking_number},
{"key": "_original_order_date", "value": order_date.strftime("%Y-%m-%d %H:%M:%S")}
]
}
but was still not able to get the back date in order when importing the order created date as it still shows the present in order. Is there any way to pass the back date for the order? If not rest API is there any other way to import orders in bulk?
本文标签: wordpressCreating a back date order in woocommerce using REST APIStack Overflow
版权声明:本文标题:wordpress - Creating a back date order in woocommerce using REST API - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742402681a2468200.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论