orders

How to get Order key for creating custom order return url in WooCommerce

杀马特。学长 韩版系。学妹 提交于 2019-12-06 09:34:16
This is the code that I am using to get a custom Order return URL: global $woocommerce; $test_order = new WC_Order($order_id); $test_order_key = $test_order->order_key; $returnURL = site_url().'/checkout/order-received/7140/'.$test_order_key; The example URL that I need is: http://www.example.com/checkout/order-received/[order_number]/key=[wc-order-key] How do I get [wc-order-key] ? Thanks. There is 2 ways to get the order key: 1) From an instance of WC_Order object class using the method get_order_key() , this way: // Get an instance of the WC_Order object $order_obj = WC_get_order($order_id)

Add Cancel button on My account Orders list using Woo Cancel for Customers Plugin

北慕城南 提交于 2019-12-06 09:33:27
问题 In My WooCommerce website I am using this plugin WooCommerce Order Cancel for Customers which allow customers to cancel their order based on payment type and on a time delay. But the cancel button only appears on the " woocommerce_order_details_after_order_table ". I would like this cancel button to appear in the "My account" > "Orders list" near the "View" button: I have tried to edit the plugin and adding this code: add_filter('woocommerce_my_account_my_orders_actions', array($this, 'order

Restrict woocommerce order status by role

故事扮演 提交于 2019-12-06 08:22:03
问题 I'm trying to make a workflow where shop managers can create orders and mark them as "pending payment", "processing" but only admins can mark orders as "complete", "failed" etc. The closest I've found was in this post: <?php if ( current_user_can(! 'administrator' ) ) { $args = array( 'post_type' => 'post', 'post_status' => 'publish, pending, draft' ); } else { $args = array( 'post_type' => 'post', 'post_status' => 'publish' ); } $wp_query = new WP_Query($args); while ( have_posts() ) : the

Add custom bulk actions to admin orders list in Woocommerce 3

喜你入骨 提交于 2019-12-06 07:43:27
问题 In Woocommerce backend (admin) , I have a function that allows the shop-manager to download all orders between two dates with a specific bunch of required data: function write_to_file($date_initial, $date_final) { global $attach_download_dir, $attach_download_file; // Opens/creates file $myfile = fopen($attach_download_dir . '/' . $attach_download_file, "w") or die("Unable to open file!"); // Populates first line fwrite($myfile, 'Date; Parent Order ID; Order ID' . PHP_EOL); // Retrieves

Add a button on top of admin orders list in woocommerce

℡╲_俬逩灬. 提交于 2019-12-06 07:37:41
I have been struggling to find a hook that allows me to add a button to the top of the woocommerce admin "orders page", but so far unsuccessfully. I have found hooks to add action buttons to the action column, as well as inside each orders page ... but not where I need now. If there is no hook, then an alternative approach. More specifically, I attach an image with the place I am referring to Any suggestions? Because this is related to Wordpress and not specific to Woocommerce as Orders are just a custom post type. so the following code will display a custom button on the top zone just after

WooCommerce change order status BACS processing

穿精又带淫゛_ 提交于 2019-12-06 07:24:02
问题 In WooCommerce any order placed with the BACS (direct bank transfer) is set to "on-hold" . How would one go about changing this automatically to processing? I wan't it to work inside the functions.php I have the following code but that doesn't work: add_filter( 'woocommerce_payment_complete_order_status', 'rfvc_update_order_status', 10, 2 ); function rfvc_update_order_status( $order_status, $order_id ) { $order = new WC_Order( $order_id ); if ( 'on-hold' == $order_status && 'on-hold' ==

Display custom checkout field value in Woocommerce admin order edit pages

亡梦爱人 提交于 2019-12-06 06:30:29
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' => true ); return $fields; } This code is adding custom field to billing form. It's working fine

Add a custom placeholder to email subject in WooCommerce

浪尽此生 提交于 2019-12-06 06:24:37
问题 I have a Woocommerce shop and I wanted to add a delivery_date after I accept the payment. I create a custom field in the order section named delivery_date with a date value. Now I wanted to use this custom field as a placeholder in email notification subject, like: Your order is now {order_status}. Order details are shown below for your reference: deliverydate: {delivery_date} I think the placeholder don't work like this, I need to change something in the php but I don't know where. 回答1: To

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

假如想象 提交于 2019-12-06 06:15:51
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? 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-accepted" (Accepted): // Register new custom order status add_action('init', 'register_custom_order_statuses');

Restore woocommerce orders

依然范特西╮ 提交于 2019-12-06 05:11:30
问题 Recently my server team replaced my database and they put our previous Database . So we lost our order details of one day[particular day] . Now the server team give the backup that contain the lost day order details . Now please tell how can i restore these orders ? I cannot replace our database with the given backup , because today also we have orders . Could anyone tell the step by step instruction ? I Created a new database and uploaded backup .I understand that order are saved in wp_posts