orders

Display ALL available shipping methods for each specific order on admin edit order pages in Woocommerce

二次信任 提交于 2020-08-10 18:59:11
问题 On the checkout page of my WooCommerce based site, users will have a list of shipping methods to choose from depending on what they are purchasing This is the list I want to capture: Things like “Free Shipping” for orders over a certain price “Freight Shipping” for certain items, and so on. My goal, is to display ALL available methods for each specific order , and display it on the “Edit Order / Order Details” page in the Admin view. A small feature that would help us be able to quickly

How to get Order Details from a WC_Subscription instance Object

≡放荡痞女 提交于 2020-07-31 05:48:57
问题 This one for completed initial subscription payments and subscription renewals. function payment_made($subscription){ // How do I get the order details? } add_action("woocommerce_subscription_payment_complete", "payment_made"); And this one for when a status is changed, so I can handle manual and system changes either manual overrides or failed/pending/active/whatever status based of payments or switches. function status_update($subscription, $old_status, $new_status){ // How do I get the

How to get Order Details from a WC_Subscription instance Object

非 Y 不嫁゛ 提交于 2020-07-31 05:48:50
问题 This one for completed initial subscription payments and subscription renewals. function payment_made($subscription){ // How do I get the order details? } add_action("woocommerce_subscription_payment_complete", "payment_made"); And this one for when a status is changed, so I can handle manual and system changes either manual overrides or failed/pending/active/whatever status based of payments or switches. function status_update($subscription, $old_status, $new_status){ // How do I get the

Custom meta data added to Woocommerce not displayed in order item meta

流过昼夜 提交于 2020-07-30 08:07:30
问题 I've a single piece of custom metadata to a WooCommerce order and now I want to display this on the thank you page after checkout, however, the data isn't available. The data is saved and available in the admin, I just can't seem to access it. function custom_order_item_meta( $item_id, $values ) { if ( ! empty( $values['custom_option'] ) ) { woocommerce_add_order_item_meta( $item_id, 'custom_option', $values['custom_option'] ); } } add_action( 'woocommerce_add_order_item_meta', 'custom_order

Custom meta data added to Woocommerce not displayed in order item meta

一笑奈何 提交于 2020-07-30 08:07:09
问题 I've a single piece of custom metadata to a WooCommerce order and now I want to display this on the thank you page after checkout, however, the data isn't available. The data is saved and available in the admin, I just can't seem to access it. function custom_order_item_meta( $item_id, $values ) { if ( ! empty( $values['custom_option'] ) ) { woocommerce_add_order_item_meta( $item_id, 'custom_option', $values['custom_option'] ); } } add_action( 'woocommerce_add_order_item_meta', 'custom_order

Additional action buttons to admin order list on Preview Lightbox in Woocommerce 3.3+

a 夏天 提交于 2020-07-30 03:43:06
问题 In Woocommerce Admin orders list, when clicking the icon "eye" , it opens a preview of the order in a Lightbox. At the bottom of that Lightbox (preview), there are some actions buttons that allow to change the order status. I have 5 more custom order statuses that I would like to add as action buttons too, but I don't know which hook I need to use. Does anyone know how to add more buttons to that area? Any help or advice is appreciated. 回答1: The correct hook to get this done is woocommerce

Add the Coupon Code names to Woocommerce View Order details and email notifications

|▌冷眼眸甩不掉的悲伤 提交于 2020-07-29 07:04:47
问题 I noticed that in the View Order Details and email confirmations, it reflects a discount line, but doesn't state the actual Discount Code used. Furthermore, if the discount code is $0.00 (we sometimes have a $0 code for special tracking purposes), it won't even show the code at all. I spent all day trying to find a solution -- can someone give some guidance on this? Thanks. I got this working so far to get the actual coupon code: add_action( 'woocommerce_order_details_after_order_table',

How to get the last order of a customer in Woocommerce

烂漫一生 提交于 2020-07-27 03:39:20
问题 I am using "How can I get the latest order id in Woocommerce" answer code that returns last order with a custom function get_last_order_id() . Here is my code attempt where I get order items: <?php $latest_order_id = get_last_order_id(); // Last order ID $order = wc_get_order( $latest_order_id ); // Get an instance of the WC_Order object $order_details = $order->get_data(); // Get the order data in an array $order_status = esc_html( wc_get_order_status_name( $order->get_status() ) ); $order

How to get the last order of a customer in Woocommerce

我只是一个虾纸丫 提交于 2020-07-27 03:38:25
问题 I am using "How can I get the latest order id in Woocommerce" answer code that returns last order with a custom function get_last_order_id() . Here is my code attempt where I get order items: <?php $latest_order_id = get_last_order_id(); // Last order ID $order = wc_get_order( $latest_order_id ); // Get an instance of the WC_Order object $order_details = $order->get_data(); // Get the order data in an array $order_status = esc_html( wc_get_order_status_name( $order->get_status() ) ); $order

Sorting order items by SKU in Woocommerce

人盡茶涼 提交于 2020-07-25 06:39:13
问题 I am trying to order the products by sku within an order in an email in Woocommerce . I have not had any luck with the following code. Some help? Thanks since now! add_filter( 'woocommerce_order_get_items', function( $items, $order ) { uasort( $items, function( $a, $b ) { return strnatcmp( $a['_sku'], $b['_sku'] ); } ); return $items; }, 10, 2 ); Sample sort result: INFSTRAW I NFMUFFIN INFFLORES INFTAFLOR INFTAPINK CTEPINK4 CTECAKE4 INFCHOCO UCUBTOMA 回答1: Updated On July 2020 Here is the way