orders

Conditional Cancel Button on my account orders list in Woocommerce

六月ゝ 毕业季﹏ 提交于 2019-12-06 04:34:58
This is in reference to Add Cancel button on My account Orders list using Woo Cancel for Customers Plugin answer: I also tried adding the function into functions.php and also get the too few arguments error: I did the same function provided by LoicTheAztec: add_filter( 'woocommerce_valid_order_statuses_for_cancel', 'custom_valid_order_statuses_for_cancel', 10, 2 ); function custom_valid_order_statuses_for_cancel( $statuses, $order ){ // Set HERE the order statuses where you want the cancel button to appear $custom_statuses = array( 'pending', 'processing', 'on-hold', 'failed' ); // Set HERE

Display Custom Total Saving in generated invoice in WooCommerce 3

非 Y 不嫁゛ 提交于 2019-12-06 04:20:18
In WooCommerce I am using WooCommerce Print Invoices & Packing lists plugin… How can I display the total savings of any order in the invoices generated by this plugin ? 1 year ago I have been using this code based on [ this answer ] and that was working before I updated WooCommerce : <?php $discount_total = 0; $_order = wc_get_order( $order_id ); foreach ($_order->get_items() as $order_item) { if ($order_item['variation_id'] > 0) { $line_item = wc_get_product( $order_item['variation_id'] ); } else { $line_item = wc_get_product( $order_item['product_id'] ); } $sale_price = $line_item->sale

Add coupon to the processing order email only if the customer have not used one

天涯浪子 提交于 2019-12-06 04:07:09
问题 I came across this snippet that adds a coupon to the order mail. I would like to make it appear in the processing order mail only if the customer have not used any coupon. add_action( 'woocommerce_email_before_order_table', 'add_content', 20 ); function add_content() { echo '<h2 id="h2thanks">Get 20% off</h2><p id="pthanks">Thank you for making this purchase! Come back and use the code "<strong>Back4More</strong>" to receive a 20% discount on your next purchase! Click here to continue

In magento, how to add shipment and track number to order

点点圈 提交于 2019-12-06 03:47:10
问题 I need to dynamically add a shipment and shipment track into an order, it needs to be dynamically because we will do it in batch, can you guys give me some help on this? EDIT: The user will see a page with a list of orders, then he will input the track number for each and submit the form, so I need to get a known carrier and send all orders via this carrier. 回答1: If you have a list of order ids and corresponding tracking numbers you can, $shipment_collection = Mage::getResourceModel('sales

Display orders with a custom status for “all” in Woocommerce admin orders list

℡╲_俬逩灬. 提交于 2019-12-06 01:44:33
I have created few custom order status using this code register_post_status( 'wc-arrival-shipment', array( 'label' => 'Shipped but not paid', 'public' => false, 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, 'label_count' => _n_noop( 'Shipped but not paid<span class="count">(%s)</span>', 'Shipped but not paid <span class="count">(%s)</span>' ) ) ); All is running good except of all orders listing. it shows the correct count all(3) but in the listing you will only see 1 order and it is not displaying all 2 other orders which has been

Custom order status aren't displayed on the customer my account order history

…衆ロ難τιáo~ 提交于 2019-12-06 01:38:55
In WooCommerce, I have made 2 custom order statuses. The first one is 'shipping status' and the other one is 'approved status'. After I have changed some orders status to these two new statuses (which are shipping or approved ), the customer can't view this orders on his order history page. Here is my code: function register_awaiting_shipment_order_status() { if('product_manager' == $get_roles || 'administrator' == $get_roles){ register_post_status( 'wc-shipping', array( 'label' => 'wc-shipping', 'public' => true, 'exclude_from_search' => false, 'show_in_admin_all_list' => true, 'show_in_admin

Displaying custom product data in Order items view

非 Y 不嫁゛ 提交于 2019-12-05 22:49:46
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 data, so it will always show as single item. (Note: I have enabled the option "Sold Individually" from the

Adding custom order statuses in Admin Dashboard Stats Widget

你。 提交于 2019-12-05 18:12:29
I would like to include details from custom order status in WooCommerce Admin Dashboard Stats widget. I have set 2 custom order status which comes after wc-processing . Order Flow after successful payment is: wc-processing => wc-awaiting-shipment => wc-dispatched => wc-completed . As awaiting shipment and dispatched are custom order statuses, WooCommerce stats widget is not reflecting those orders in total sales amount. The problem is that I have many orders with wc-dispatched and wc-awaiting-shipment statuses. This is code that I have used to register this custom order statuses: /** *

Get WooCommerce orders Items by variation ID

老子叫甜甜 提交于 2019-12-05 18:06:14
How can I list order items based on a specific product variations? Given a variation ID , I would like to generate a list of all order items that include that particular variation. In my case I'm using variations to represent dates and the product itself is a recurring event, so the purpose of this is to list the people attending that specific date. It would be amazing if this could be accomplished by something simple like a get_posts using meta_keys or something in that vein, but otherwise I'm guessing a custom query would be the way. I just can't seem to figure out how the tables relate in

Custom Email is not sending on Order complete in WooCommerce

我怕爱的太早我们不能终老 提交于 2019-12-05 18:05:55
I am facing a problem to send a custom email in WooCommerce. Here is Error: Fatal error: Cannot use object of type WC_Order as array in /home/wp-content/themes/structure/functions.php on line 548 My client want to send a custom email when everytime customer order and pay, besides the standard order confirmation email. Here is my code: $order = new WC_Order( $order_id ); function order_completed( $order_id ) { $order = new WC_Order( $order_id ); $to_email = $order["billing_address"]; $headers = 'From: Your Name <your@email.com>' . "\r\n"; wp_mail($to_email, 'subject', 'This is custom email',