orders

Show products name and quantity in a new column on Woocommerce My account Orders

蹲街弑〆低调 提交于 2021-02-04 06:36:25
问题 In Woocommerce, I would like to add a new column to My account orders list and show the name and quantity of ordered the products. I have this code for instance that adds a new column displaying the order name: function sv_wc_add_my_account_orders_column( $columns ) { $new_columns = array(); foreach ( $columns as $key => $name ) { $new_columns[ $key ] = $name; if ( 'order-status' === $key ) { $new_columns['order-ship-to'] = __( 'Ship to', 'textdomain' ); } } return $new_columns; } add_filter(

Change WooCommerce order status after X time has passed

不羁的心 提交于 2021-01-29 09:32:16
问题 Having searched around, i only found one other close question, but no valid answer. I would like to automatically change the order status in WooCommerce from Completed to Cancelled after 24 hours. Ideally this would only be for orders that contain a Virtual Product too. Ive tried the answer given here, but couldnt get it to work: Automatically change WooCommerce order status after specific time has passed? Would the previous answers code need to be run regularly in a cron job or something

How to get order tax details and rates in WooCommerce?

安稳与你 提交于 2021-01-29 04:08:22
问题 I'm trying to get the tax percentage for a custom variable in a plugin from an order. Of course I could request a lot of data via $order-> get_ ... , but I cannot find a method to get the tax percentage (like for example '21' -> 21%). Anyone have an idea to make this simple? 回答1: You will have to get order tax item(s) which will give you an array of WC_Order_Item_Tax Objects which protected properties are accessible using WC_Order_Item_Tax available methods like: // Get the the WC_Order

How to get order tax details and rates in WooCommerce?

拜拜、爱过 提交于 2021-01-29 04:08:11
问题 I'm trying to get the tax percentage for a custom variable in a plugin from an order. Of course I could request a lot of data via $order-> get_ ... , but I cannot find a method to get the tax percentage (like for example '21' -> 21%). Anyone have an idea to make this simple? 回答1: You will have to get order tax item(s) which will give you an array of WC_Order_Item_Tax Objects which protected properties are accessible using WC_Order_Item_Tax available methods like: // Get the the WC_Order

Display checkout field value in Woocommerce admin order list custom column

天涯浪子 提交于 2021-01-29 02:24:42
问题 I am stuck with a task. I would like to add an extra column to the shop order columns in woocommerce backend. This extra column should display an echo output if a customer checked a checkbox field on checkout. So to add the extra column it is not that hard. I did it this way. add_filter('manage_edit-shop_order_columns', 'invoice_order_overview'); function invoice_order_overview($columns) { $new_columns = (is_array($columns)) ? $columns : array(); unset($new_columns['order_actions']); //edit

Dynamic custom order numbers based on payment method

自闭症网瘾萝莉.ら 提交于 2021-01-28 22:44:45
问题 I have the following code in my functions.php file: add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number' ); function change_woocommerce_order_number( $order_id ) { $order = wc_get_order( $order_id ); //$order->get_total(); $method_of_payment = $order->get_payment_method(); if ( $method_of_payment == 'cheque' ) { $prefix = 'CHE'; $suffix = ''; $new_order_id = $prefix . $order_id . $suffix; return $new_order_id; } else { return $order_id; } } The code works but I want it to

Change order item custom meta data displayed label and value in WooCommerce Admin orders

别等时光非礼了梦想. 提交于 2021-01-28 21:31:47
问题 In the Woocommerce admin screen, I'm attempting to use the order line meta data to display a button which will open up a new window with the URL of the dropship supplier. I have successfully pulled the supplier URL from the product on order and pushed it to the order line item. I am able to change the meta data to a button but the consequence of that is the other custom fields which contain the custom options are wiped. This is the full code which I have added to the functions.php file add

Woocommerce Gateway default order status customization

隐身守侯 提交于 2021-01-28 12:15:06
问题 I've used the following code which works fine, it makes all orders default status to be on hold. /** * Auto Complete all WooCommerce orders. */ add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' ); function custom_woocommerce_auto_complete_order( $order_id ) { if ( ! $order_id ) { return; } $order = wc_get_order( $order_id ); $order->update_status( 'on-hold' ); } But I need to combine this with shipping/billing address. i.e. execute this code Only if the order's

Save custom delivery dates range calculations to WooCommerce order meta data

為{幸葍}努か 提交于 2021-01-28 10:05:53
问题 I use woocommerce and have written a function, which displays a date range for expected delivery based on the stock status... For reference: Display an estimated delivery date range based on WooCommerce cart item stock Now I want to output the calculated date range into my admin panel for each order. For the Orders edit pages in the Wordpress backend I use this code: add_action( 'add_meta_boxes', 'add_meta_boxes' ); function add_meta_boxes() { add_meta_box( 'woocommerce-order-my-custom', __(

Save custom delivery dates range calculations to WooCommerce order meta data

佐手、 提交于 2021-01-28 10:02:45
问题 I use woocommerce and have written a function, which displays a date range for expected delivery based on the stock status... For reference: Display an estimated delivery date range based on WooCommerce cart item stock Now I want to output the calculated date range into my admin panel for each order. For the Orders edit pages in the Wordpress backend I use this code: add_action( 'add_meta_boxes', 'add_meta_boxes' ); function add_meta_boxes() { add_meta_box( 'woocommerce-order-my-custom', __(