orders

Add a custom field to an order in WooCommerce 3+

十年热恋 提交于 2021-02-10 14:18:02
问题 In WooCommerce, I would like to add a new custom field to order details. I now that I can use use the code below to create a new custom field 'referenceNumber' and adds in it "ordercreated" value: update_post_meta($order_id, 'referenceNumber', 'ordercreated']); What I would like is to make that through checkout once an order is placed. But it doesn't work it doesn't add a new custom field to order details page and don't add the value 'ordercreated', as you can see in this screenshot: So the

Set an external order ID when creating programmatically a WooCommerce order

女生的网名这么多〃 提交于 2021-02-10 05:35:51
问题 I've been using some well documented code to programatically create Woocommerce orders. Working great. Reference here: https://quadlayers.com/add-products-woocommerce/ However I'd be keen to know if it's possible to define the order_id (or is that the post_id?) whilst creating my WC orders via a script. I run this code on my shop, which currently imports orders into Woocommerce from a marketplace online where orders already have an Order number and I'd be keen to cut out the cross-referencing

Set an external order ID when creating programmatically a WooCommerce order

拟墨画扇 提交于 2021-02-10 05:35:11
问题 I've been using some well documented code to programatically create Woocommerce orders. Working great. Reference here: https://quadlayers.com/add-products-woocommerce/ However I'd be keen to know if it's possible to define the order_id (or is that the post_id?) whilst creating my WC orders via a script. I run this code on my shop, which currently imports orders into Woocommerce from a marketplace online where orders already have an Order number and I'd be keen to cut out the cross-referencing

Add and save a text field in WooCommerce customer order detail pages

心已入冬 提交于 2021-02-10 04:41:32
问题 I have been able to add a custom text input field, in woocommerce's order details page, but I can't save the data submitted data. This is the code: add_action( 'woocommerce_order_details_before_order_table', 'add_custom_Field',10,2 ); function add_custom_Field( $order_id) { $user = wp_get_current_user(); $order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id; ?> <form method="post"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">

Add and save a text field in WooCommerce customer order detail pages

时光毁灭记忆、已成空白 提交于 2021-02-10 04:40:47
问题 I have been able to add a custom text input field, in woocommerce's order details page, but I can't save the data submitted data. This is the code: add_action( 'woocommerce_order_details_before_order_table', 'add_custom_Field',10,2 ); function add_custom_Field( $order_id) { $user = wp_get_current_user(); $order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id; ?> <form method="post"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">

Change user role based on WooCommerce yearly orders count

旧时模样 提交于 2021-02-08 09:14:06
问题 I'm trying to implement a feature where customers receive a new user role after a certain amount of orders have been made, but all those orders must have been made within the same year. I was able to assign the user role based on nth number of orders but can't seem to go beyond to where the date needs to be taken into consideration, can someone point me in the right direction or point out what I might be missing. This is what I have tried so far. function change_user_role_on_order_status

Output product custom field values in order email notification

懵懂的女人 提交于 2021-02-08 08:36:10
问题 I have a custom field for a Woocommerce's product, and I want to display it's value in order emails. As I'm using custom product submission form, I added this code for custom field below to create a custom field: <?php WCVendors_Pro_Form_Helper::select( array( 'post_id' => $object_id, 'class' => 'select2', 'id' => 'wcv_custom_product_ingredients', 'label' => __( 'What time?', 'wcvendors-pro' ), 'placeholder' => __( 'Pick a time', 'wcvendors-pro' ), 'wrapper_start' => '<div class="all-100">',

Hiding order status in My Account recent orders list page

帅比萌擦擦* 提交于 2021-02-08 07:34:46
问题 In WooCommerce, I have a Woocommerce site and on the customer's recent orders page, there is a table with order details on this example link: https://example.com/my-account/view-order/ I would like to completely hide order status from the table if possible. How can I achieve this? Thanks 回答1: Updated: Just use this custom function hooked in woocommerce_my_account_my_orders_columns filter hook: add_filter('woocommerce_my_account_my_orders_columns', 'custom_removing_order_status', 10, 1);

Auto set specific attribute term value to purchased products on Woocommerce

痴心易碎 提交于 2021-02-08 06:58:18
问题 I want to automatically add a specific attribute value (which was previously set up) to ordered products when the order is placed and has "on-hold" status. I sell unique products and I have set up the "STOCK" attribute and the "Out Of Stock" (out-of-stock) value. When an order is placed and has "on-hold" status, I want to automatically change the featured status of the ordered products and also to add the out-of-stock attribute value to it. The featured part is done and works, but I can't

Customizing email subject with dynamic data in Woocommerce [closed]

懵懂的女人 提交于 2021-02-08 03:34:45
问题 Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question Not a duplicate of Display order total with and without VAT in Woocommerce's order email notification. How can I customize the subject of the E-mail, (not the body. I know how to edit the variables in the body, but the same variables don't work in the subject for some reason). So