orders

How to reduce the stock for specific order status in WooCommerce

折月煮酒 提交于 2021-02-05 08:21:45
问题 I am managing my stock on WooCommerce. I would like to reduce the stock when the order status changes to a specific status for example (pending) or other status. So I used this code: function manageStock ($order_id, $old_status, $new_status, $instance ) { if ($old_status === 'on-hold'){ wc_reduce_stock_levels($order_id); } } add_action( 'woocommerce_order_status_changed', 'manageStock', 10, 4 ); But unfortunately does not work. Is there another way to solve this problem? 回答1: Stock is already

How to reduce the stock for specific order status in WooCommerce

跟風遠走 提交于 2021-02-05 08:21:29
问题 I am managing my stock on WooCommerce. I would like to reduce the stock when the order status changes to a specific status for example (pending) or other status. So I used this code: function manageStock ($order_id, $old_status, $new_status, $instance ) { if ($old_status === 'on-hold'){ wc_reduce_stock_levels($order_id); } } add_action( 'woocommerce_order_status_changed', 'manageStock', 10, 4 ); But unfortunately does not work. Is there another way to solve this problem? 回答1: Stock is already

Display a product custom field only in WooCommerce Admin single orders

戏子无情 提交于 2021-02-05 08:13:18
问题 This question follows How to show a product custom field (custom SKU) in WooCommerce orders answer to my previous question. How do I make a product custom field articleid (custom SKU) to be visible only in Admin Order edit pages for each order item? Also, it does not work for manual orders. How to display a product custom field articleid (custom SKU) on manual orders too ? 回答1: Updated last function to avoid errors with other order item types that "line items". To make it only visible on

Add customer note from another script in WooCommerce

拈花ヽ惹草 提交于 2021-02-05 07:09:25
问题 I have a script that changes the status of orders based on our ERP system. In addition to that, we need to add customer notes. I found the way to do it: $order->add_order_note($note); $order->save(); Unfortunately this won't work outside the order edit screen, I tried to run it from my custom plugin. (source) If I do it via $order->update_status($status, $note); it only updates the status. Is there a way to add a note outside the edit screen? (Including e-mailing the customer) 回答1: If the

Auto add or update a custom fee via admin edit orders in WooCommerce

梦想的初衷 提交于 2021-02-04 08:09:35
问题 We have a special case where we invoice our customers for payment after the order has been received instead of having them pay during checkout. Shipping charges are manually calculated and added to the order and then we add a 3% credit card fee on the grand total. To automate this process, I created a script that calculates the 3% charge once the shipping charge has been set through the backend and adds this fee item into the order automatically. This works when we add the shipping charge and

Auto add or update a custom fee via admin edit orders in WooCommerce

蓝咒 提交于 2021-02-04 08:09:18
问题 We have a special case where we invoice our customers for payment after the order has been received instead of having them pay during checkout. Shipping charges are manually calculated and added to the order and then we add a 3% credit card fee on the grand total. To automate this process, I created a script that calculates the 3% charge once the shipping charge has been set through the backend and adds this fee item into the order automatically. This works when we add the shipping charge and

Auto add or update a custom fee via admin edit orders in WooCommerce

烈酒焚心 提交于 2021-02-04 08:09:01
问题 We have a special case where we invoice our customers for payment after the order has been received instead of having them pay during checkout. Shipping charges are manually calculated and added to the order and then we add a 3% credit card fee on the grand total. To automate this process, I created a script that calculates the 3% charge once the shipping charge has been set through the backend and adds this fee item into the order automatically. This works when we add the shipping charge and

Display a product custom field only in WooCommerce Admin single orders for Manual Orders

限于喜欢 提交于 2021-02-04 07:56:08
问题 Following Display a product custom field only in WooCommerce Admin single orders answer to my previous question, which: Adds a Custom SKU Field (ArticleID) Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data for Manual Orders However, it seems that the last part (for Manual Orders) is causing a conflict with this following other custom code I added for Gateway Fees: // Assign Card Gateway Percentage Fee to Wholesaler

Change order item displayed meta key label in WooCommerce admin order pages

泄露秘密 提交于 2021-02-04 07:28:11
问题 Following Display a product custom field only in WooCommerce Admin single orders answer to my previous question, which: Adds a Custom SKU Field (ArticleID) Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data for Manual Orders How can I change the displayed meta key label _articleid on order line items section of the admin single order pages? Right now it shows the "SKU", the "Variation ID" (for product variations) and

Change order item displayed meta key label in WooCommerce admin order pages

五迷三道 提交于 2021-02-04 07:28:06
问题 Following Display a product custom field only in WooCommerce Admin single orders answer to my previous question, which: Adds a Custom SKU Field (ArticleID) Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data for Manual Orders How can I change the displayed meta key label _articleid on order line items section of the admin single order pages? Right now it shows the "SKU", the "Variation ID" (for product variations) and