From bc750a5b3a2cae5b32dc173ad1e8611181f09b97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ey=C3=BCp=20G=C3=BCl=C5=9Fen?=
<40281221+MrEbabi@users.noreply.github.com>
Date: Sun, 8 Nov 2020 16:27:16 +0300
Subject: [PATCH] update function names
---
functions.php | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/functions.php b/functions.php
index 4c7363d..d940cd6 100644
--- a/functions.php
+++ b/functions.php
@@ -1,23 +1,19 @@
-// Display an action button in admin order list header
-add_action( 'manage_posts_extra_tablenav', 'admin_order_list_top_bar_button', 20, 1 );
-function admin_order_list_top_bar_button( $which ) {
- global $pagenow, $typenow;
+add_action( 'manage_posts_extra_tablenav', 'admin_order_list_top_combine_button', 20, 1 );
+function admin_order_list_top_combine_button( $which ) {
+ global $pagenow, $typenow;
if ( 'shop_order' === $typenow && 'edit.php' === $pagenow && 'top' === $which ) {
- ?>
-
-
-
-
-
-
+
+
+
+ ";
}
}
-// Trigger an action (or run some code) when the button is pressed
-add_action( 'restrict_manage_posts', 'display_admin_shop_order_language_filter' );
-function display_admin_shop_order_language_filter() {
+add_action( 'restrict_manage_posts', 'display_admin_shop_order_combine_orders' );
+
+function display_admin_shop_order_combine_orders() {
global $pagenow, $typenow;
if ( 'shop_order' === $typenow && 'edit.php' === $pagenow &&
@@ -42,26 +38,23 @@ function display_admin_shop_order_language_filter() {
{
$product = wc_get_product($product_id);
$second_order->add_product($product, $product_quantity);
- //wc_update_product_stock($product, $product_quantity, 'decrease');
}
//if product type is variable
else
{
$variation = wc_get_product($variation_id);
$second_order->add_product($variation, $product_quantity);
- //wc_update_product_stock($variation, $product_quantity, 'decrease' );
}
}
$status = $second_order->get_status();
$second_order->calculate_totals();
$second_order->update_status('pending');
$second_order->update_status($status);
- $first_order->update_status("cancelled", "Combined with order no: $second_order_id.");
- $second_order->add_order_note("Combined with order no: $first_order_id.");
+ $first_order->update_status("cancelled", "This order is cancelled since it is combined with order ID: $second_order_id.");
+ $second_order->add_order_note("Order ID: $first_order_id is cancelled and combined with this order.");
}
-
$URL = get_admin_url();
$URL .= "edit.php?post_type=shop_order";
- echo "";
+ echo "";
}
}