Skip to content

Commit

Permalink
Fix: Espaçamento resolvido e função agora com 4 paranmetros
Browse files Browse the repository at this point in the history
  • Loading branch information
lucastgama committed Oct 11, 2024
1 parent 21da434 commit 7c58e6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/includes/admin/ButtonPaymentLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ 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');
$this->include_template_with_variables($template_path, $variables, $order_info);
}
}

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;
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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}";
}
Expand Down
3 changes: 0 additions & 3 deletions src/templates/admin-payment-button.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@
</span>
<?php endif; ?>
<?php if ($single && $sub) : ?>
<?php error_log(var_export($single,true)); ?>
<?php error_log(var_export($sub,true)); ?>

<span class="notificationPaymentLink">
<?php
echo esc_html__(
Expand Down

0 comments on commit 7c58e6e

Please sign in to comment.