orders

Filter out unwanted order item meta data from Woocommerce email notifications

泪湿孤枕 提交于 2019-12-13 18:03:14
问题 In the order email templates (for example email-order-items.php ), WooCommerce uses the function wc_display_item_meta to display product details in the order table. The function code is present in the wc-template-functions.php file (line number 3011). I am copying the function code below for reference function wc_display_item_meta( $item, $args = array() ) { $strings = array(); $html = ''; $args = wp_parse_args( $args, array( 'before' => '<ul class="wc-item-meta"><li>', 'after' => '</li></ul>

Woocommerce display custom field data on admin order details

我的梦境 提交于 2019-12-13 12:32:33
问题 I am using a custom checkout field to give my customers a 'Ship to a business address' option on the checkout page of my woocommerce store. Most of the code is working properly, but I am unable to display whether or not they checked the box in the admin order details in the back end. I have added a custom checkout field to my woocommerce shop, and saved the data to the order meta: //add custom checkout field add_filter( 'woocommerce_after_checkout_billing_form', 'gon_business_address_checkbox

Woocommerce disable automatic order status change pending->processing

*爱你&永不变心* 提交于 2019-12-13 12:22:18
问题 I want to dissable this option: Whenever someone makes and order on my site and the payment is successfull the order status automaticaly changes from pending to processing . However I don`t want this feature to have enabled . Rather I want to do it manually when i proces the orders. I found this function in the woocommerce which is making this feature possible. I don`t want to directly change it there but rather with some kind of php snippet which overrides this function. Here is the function

Email recipients based on Shipping method Id for Woocommerce new order notification

末鹿安然 提交于 2019-12-13 10:35:51
问题 In Woocommerce, I would like to have a new order email sent to specific persons based on the selected shipping method ID. Right now, I am only able to have every email address added to the new order email, but ultimately want to have the email be sent to one specific email based on the shipping method Id selected by the customer. Here is my code coming from this answer that works for postal code: add_filter( 'new_order' , 'so_26429482_add_recipient', 20, 2 ); function so_26429482_add

Additional checkout payment gateway field for Authorize.net in Woocommerce

大兔子大兔子 提交于 2019-12-13 03:05:16
问题 I'm trying to add an additional field inside the Authorize.net Payment Gateway plugin for WooCommerce. The following code will add a field into a default gateway, like COD or BACS. This solution was found here. if( 'cod' === $payment_id ){ ob_start(); // Start buffering echo '<div class="bacs-options" style="padding:10px 0;">'; woocommerce_form_field( 'bacs_option', array( 'type' => 'text', 'label' => __("Fill in this field", "woocommerce"), 'class' => array('form-row-wide'), 'required' =>

Show Woocommerce custom checkout field value in admin order making them editable

无人久伴 提交于 2019-12-13 01:06:53
问题 I am using "Show hide custom WooCommerce checkout field based on selected payment method" answer to one of my questions, to show / hide a custom checkout billing field, and it works fine. Question: Is it possible to show my Custom field in WooCommerce orders in the admin panel? 回答1: To display "billing_options" custom checkout billing field value in admin order pages on the billing information column, use the following: add_action( 'woocommerce_admin_order_data_after_billing_address',

Changing WooCommerce processing orders status based on product stock quantity

风流意气都作罢 提交于 2019-12-12 20:25:37
问题 I'm currently working on an automated status changes for WooCommerce orders: When a product stock reaches 50%, I am trying to change all related "processing" orders to 'kundenupdate' order status. I am using the function retrieve_orders_ids_from_a_product_id() from this answer thread, querying orders with "processing" status, form a product ID in the code below: function retrieve_orders_ids_from_a_product_id( $product_id ) { global $wpdb; // Define HERE the orders status for queried orders

How can I get the latest order id in Woocommerce

ε祈祈猫儿з 提交于 2019-12-12 17:24:43
问题 In Woocommerce I am trying to get the latest order ID. I have tried this: global $post; $order_id = $post->ID; $order = new WC_Order($order_id); $order_details = $order->get_data(); But it didn't work. How to get the latest order ID in woocommerce? 回答1: Here is a custom function that will return the last order ID: function get_last_order_id(){ global $wpdb; $statuses = array_keys(wc_get_order_statuses()); $statuses = implode( "','", $statuses ); // Getting last Order ID (max value) $results =

WooCommerce: autocomplete paid orders based on shipping method

情到浓时终转凉″ 提交于 2019-12-12 14:59:45
问题 I have a product that people can print directly (shipping method 1) or choose to get it via shipping service (shipping method 2). So the order should auto complete if they choose to print it directly (shipping method 2) ONLY. Is it possible to extend that code snippet from WooCommerce? From docs I found this /** * Auto Complete all WooCommerce orders. */ add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order'); function custom_woocommerce_auto_complete_order( $order_id )

WooCommerce get order quantity in thank you page and redirect

久未见 提交于 2019-12-12 10:17:20
问题 What I have done is I redirect the page after purchase but now I want to get the value of ordered quantity so that I can use it to my switch statement for some reason. How can I get the value of ordered quantity of the item? function wc_custom_redirect_after_purchase() { global $wp; if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { //wp_redirect( 'http://grimmindustries.com.au/matchmaker/' ); $quantity = ; // ordered quantity that I need to use to switch statement to