diff --git a/src/includes/admin/ButtonPaymentLink.php b/src/includes/admin/ButtonPaymentLink.php index 8662d535..06dd36b4 100644 --- a/src/includes/admin/ButtonPaymentLink.php +++ b/src/includes/admin/ButtonPaymentLink.php @@ -31,7 +31,7 @@ public function button_link_payment($order) $type = get_post_type($order->get_id()); $created = $order->get_created_via(); $parent = $order_data['parent']; - $disable = $this->should_disable($created, $sub, $item, $order, $order_data); + $disable = $this->should_disable($created, $sub, $order, $order_data); $hasClient = $order->get_customer_id(); $order_info = compact('type', 'created', 'parent', 'disable', 'hasClient'); $variables = compact('item', 'sub', 'status', 'link', 'shop', 'single'); @@ -39,10 +39,11 @@ public function button_link_payment($order) } } - private function should_disable($created, $has_sub, $has_item, $order, $order_data) + private function should_disable($created, $has_sub, $order, $order_data) { $posttype = get_post_type(); $hasClient = $order->get_customer_id(); + $has_item = $order_data['has_item']; if (!$hasClient || !$has_item) { return false; @@ -136,7 +137,7 @@ private function has_single_product($order) $subscriptions_product = new WC_Subscriptions_Product(); $order_items = $order->get_items(); foreach ($order_items as $order_item) { - if(!$subscriptions_product->is_subscription($order_item->get_product_id())){ + if (!$subscriptions_product->is_subscription($order_item->get_product_id())) { return true; } } @@ -157,7 +158,7 @@ public function build_payment_link($order, $gateway) $orderKey = $order->get_order_key(); $is_renewal = get_post_meta($order->get_id(), '_subscription_renewal', true); - if($is_renewal){ + if ($is_renewal) { $url = get_site_url(); return "{$url}/my-account/view-order/{$orderId}"; } diff --git a/src/templates/admin-payment-button.html.php b/src/templates/admin-payment-button.html.php index 13c3196b..997a12d8 100644 --- a/src/templates/admin-payment-button.html.php +++ b/src/templates/admin-payment-button.html.php @@ -84,9 +84,6 @@ - - -