WooCommerce 增加新订单状态的库存
我添加了一个新的订单状态来检查“更改订单”。 我想通过使用此订单状态来增加库存水平,因为客户会将产品寄回给我。它将遵循类似于已取消订单状态的路径,但只有订单状态的名称会是“更改”。当订单状态为“变更”时,将根据订单中的产品数量增加变体产品的库存。
前任: A102-L 库存:12, A108-M 库存: 15.
订单中产品的库存代码和数量: 订单号:1234 订购产品: A102-L-> 1个 A108-M-> 2 件
假设使用这些产品创建了订单。当我将 Woocommerce 订单状态设置为“正在处理”时,它会将 A102-L 的库存水平更新为 11,将 A108-M 的库存水平更新为 13。当我将此订单状态更改为“更改”时,我想将 A102-L 的库存水平更新为 12(11+1),将 A108-M 的库存水平更新为 15(13+2)。
我添加了新的订单状态名称,但无法执行库存增加部分。我该怎么做呢?
I added a new order status to check for "change orders".
I want to increase the stock level by using this order status as the customer will send the product back to me. It will follow a path like the canceled order status, but only the name of the order status will be "change". When the order status is "change", it will increase the stock of the variation product by the quantity of products in the order.
Ex:
A102-L stock: 12,
A108-M stock: 15.
Stock codes and quantities of the products in the order:
Order ID: 1234
order products:
A102-L -> 1 pc
A108-M -> 2 pcs
Suppose an order is created with these products. When I make the Woocommerce order status "processing" it updates the stock levels to 11 for A102-L and 13 for A108-M. When I make this order status "change" , I want to update the stock levels as 12(11+1) for A102-L and 15(13+2) for A108-M.
I added the new order status name but I couldn't do the stock increase part. How can I do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每当订单状态发生变化时,都会触发此挂钩。
因此,当订单状态更新为“更改”时,可以按如下方式增加订单中商品的库存水平。将代码添加到活动主题functions.php中
This hook is triggered whenever an order status changes.
So to increase stock level of items in an order when the order status updated to 'change' can be done like below. Add the code into active theme functions.php