orders

Auto change order status from hold-on to processing in Woocommerce

我的未来我决定 提交于 2019-12-08 02:41:40
问题 I would like to change every order from woocommerce with the status 'HOLD-ON' to 'PROCESSING' with php . I already tried to write a function in the functions.php file but I failed. How can I auto change order status from "hold-on" to "processing" in Woocommerce? 回答1: To auto-process orders, you should try the following: add_action( 'woocommerce_thankyou', 'woocommerce_auto_processing_orders'); function woocommerce_auto_processing_orders( $order_id ) { if ( ! $order_id ) return; $order = wc

Add a custom cart item value to WooCommerce order item meta data

久未见 提交于 2019-12-08 02:20:05
问题 I'm trying add order item meta and expect to see it in my {prefix}woocommerce_order_itemmeta table when user submit order. I add my value with woocommerce_add_cart_item_data filter: add_filter( 'woocommerce_add_cart_item_data', 'aa_func_20170206100217', 10, 3 ); function aa_func_20170206100217( $cart_item_data, $product_id, $variation_id ) { $data = $_POST; if ( isset( $data[ 'selected_date_event' ] ) ) { $selected_date_event = [ 'selected_date_event' => $data[ 'selected_date_event' ] ];

WooCommerce order status change from payment gateway

送分小仙女□ 提交于 2019-12-08 01:50:46
问题 I have integrated a payment gateway to accept online payments for my store running on woocommerce. Everything works fine but I noticed that woocommerce is changing the order status to wc-processing for all the online paid orders by default. As per my store's functionality I want all the online paid orders to be in wc-on-hold status initially. Is there any way to stop woocommerce changing the order status to wc-processing programatically? 回答1: yes there is a way, but you need to modify the

WooCommerce hook after order is updated?

孤街醉人 提交于 2019-12-08 01:39:26
问题 Is there a hook I can use when I make a change to someone's order via the admin (such as their address, or a custom meta field)? I read this question but unfortunately woocommerce_process_shop_order_meta is fired before the order is saved, meaning I have no access to the newly updated data. What I need is to be able to use the new data that is saved to the order. UPDATE: An issue with using save_post_shop_order is that the meta is updated before this is hit, so I can't compare the previously

Replace the product name by the Sku in My account view order pages

别说谁变了你拦得住时间么 提交于 2019-12-07 23:46:25
Using Woocommerce, I would like to add SKU instead of the product name in the order view page of My Account /my-account/view-order/[orderid]/ I am able to add the SKU with a link using the code below. The SKU is displayed just after the product name on the same line. add_filter( 'woocommerce_order_item_name', 'display_sku_in_order_item', 20, 3 ); function display_sku_in_order_item( $item_name, $item, $is_visible ) { if( is_wc_endpoint_url( 'view-order' ) ) { $product = $item->get_product(); if( $sku = $product->get_sku() ) $item_name .= '<a href="' . $product->get_permalink() . '" class=

Display custom checkout field value in Woocommerce admin order edit pages

丶灬走出姿态 提交于 2019-12-07 23:14:28
问题 I have the function in functions.php: // Hook in add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); // Our hooked in function - $fields is passed via the filter! function custom_override_checkout_fields( $fields ) { $fields['billing']['billing_infos'] = array( 'type' => 'textarea', 'label' => __('Podaj NIP', 'woocommerce'), 'placeholder' => _x('Tutaj możesz wpisać NIP', 'placeholder', 'woocommerce'), 'required' => false, 'class' => array('form-row-wide'), 'clear'

Add custom order status to filter menu in WooCommerce Admin Orders list

匆匆过客 提交于 2019-12-07 22:25:59
问题 I'm currently trying to add new quick filters (subsubsub) to the WooCommerce admin orders list: I've a custom order status which is named "wc-test-accepted". How can I add a new quick filter for my custom order status to the top? 回答1: To get the related filter to your custom order status "wc-test-accepted" in the orders statuses menu filter, you just need to change the status of at least one order and the filter will appear. The following code will add new a custom order status "wc-test

Show custom fields on the order editing page in WooCommerce

旧时模样 提交于 2019-12-07 18:41:16
问题 Based on "Show woocommerce product custom fields under the cart and order item name" answer to one of my previous questions, The code shows custom fields on the product edit page. When these fields are filled in, data is displayed on the product page. Here is the code: // Backend: Display additional product fields add_action('woocommerce_product_options_general_product_data', 'add_fields_to_options_general_product_data'); function add_fields_to_options_general_product_data() { // Custom

Auto completed status for all existing processing orders in WooCommerce

天涯浪子 提交于 2019-12-07 18:14:25
问题 I am using on WooCommerce this little peace of code from this answer to autocomplete paid processing orders: /** * AUTO COMPLETE PAID ORDERS IN WOOCOMMERCE */ add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_paid_order', 10, 1 ); function custom_woocommerce_auto_complete_paid_order( $order_id ) { if ( ! $order_id ) { return; } $order = wc_get_order( $order_id ); // No updated status for orders delivered with Bank wire, Cash on delivery and Cheque payment methods. if ( (

Displaying custom product data in Order items view

烂漫一生 提交于 2019-12-07 14:12:07
问题 I have a issue with add to cart. I have a product with different custom conditions to choose. When the customer selects a specific choice. it adds to the cart. When the customer choice another choice and adds. Its shows as a second item in the cart. Which is okay. But after the payment, the order shows the both the custom option under the item 1 and item 2 without the custom data. so I was thinking instead of showing the same product as different items. I want to update the product custom