Skip to content

Commit

Permalink
AutoShip Compatibility Bug, ref #718
Browse files Browse the repository at this point in the history
  • Loading branch information
kcppdevelopers committed May 12, 2017
1 parent e95379c commit d68edc9
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions angelleye-includes/angelleye-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ public function load_dependencies() {
public function angelleye_woocommerce_order_actions($order_actions = array()) {
global $post;
$order_id = $post->ID;
if( empty($post->ID) ) {
return false;
}
if($post->post_type != 'shop_order') {
return false;
}
if (!is_object($order_id)) {
$order = wc_get_order($order_id);
}
Expand Down Expand Up @@ -627,6 +633,9 @@ public function angelleye_woocommerce_payment_gateway_supports($boolean, $featur
if( empty($post->ID) ) {
return false;
}
if($post->post_type != 'shop_order') {
return false;
}
$order_id = $post->ID;
if (!is_object($order_id)) {
$order = wc_get_order($order_id);
Expand Down Expand Up @@ -1040,6 +1049,12 @@ public static function get_post_id_by_meta_key_and_meta_value($key, $value) {
}

public function save($post_id, $post) {
if( empty($post->ID) ) {
return false;
}
if($post->post_type != 'shop_order') {
return false;
}
$order = wc_get_order($post_id);
if (empty($this->payment_method)) {
$old_wc = version_compare(WC_VERSION, '3.0', '<');
Expand Down Expand Up @@ -1129,6 +1144,10 @@ public function angelleye_paypal_for_woocommerce_order_status_handler($order) {
public function angelleye_express_checkout_transaction_capture_dropdownbox($post_id) {
global $wpdb;
$order = wc_get_order($post_id);
if( empty($order) ) {
return false;
}

wp_reset_postdata();
$old_wc = version_compare(WC_VERSION, '3.0', '<');
$order_id = version_compare( WC_VERSION, '3.0', '<' ) ? $order->id : $order->get_id();
Expand Down Expand Up @@ -1294,6 +1313,9 @@ public static function number_format($price) {

public function angelleye_is_display_paypal_transaction_details($post_id) {
$order = wc_get_order($post_id);
if( empty($order)) {
return false;
}
$old_wc = version_compare(WC_VERSION, '3.0', '<');
$order_id = version_compare( WC_VERSION, '3.0', '<' ) ? $order->id : $order->get_id();
$_payment_method = $old_wc ? get_post_meta($order_id, '_payment_method', true) : get_post_meta($order->get_id(), '_payment_method', true);
Expand All @@ -1316,6 +1338,12 @@ public static function is_valid_for_use_paypal_express() {
public function angelleye_set_payment_method() {
if( empty($this->payment_method) || $this->payment_method == false) {
global $post;
if( empty($post->ID) ) {
return false;
}
if($post->post_type != 'shop_order') {
return false;
}
$old_wc = version_compare(WC_VERSION, '3.0', '<');
$order = wc_get_order($post->ID);
$order_id = version_compare( WC_VERSION, '3.0', '<' ) ? $order->id : $order->get_id();
Expand All @@ -1330,6 +1358,9 @@ public function angelleye_set_payment_method_using_transaction_id($transaction)
if( !empty($results[0]->post_id) ) {
$old_wc = version_compare(WC_VERSION, '3.0', '<');
$order = wc_get_order($results[0]->post_id);
if( empty($order) ) {
return false;
}
$order_id = version_compare( WC_VERSION, '3.0', '<' ) ? $order->id : $order->get_id();
$this->payment_method = $old_wc ? get_post_meta($order_id, '_payment_method', true) : get_post_meta($order->get_id(), '_payment_method', true);
}
Expand Down

0 comments on commit d68edc9

Please sign in to comment.