Skip to main content
deleted 73 characters in body; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

How can i make this code much better for clean code? Woocommerce order change status

This code can woocommerce order change status. But as you can see, this code is hard to read. So my question is a "howHow can iI make fix better for clean code ". Can you advice me for thatit cleaner? THX

How can i make this code much better for clean code?

This code can woocommerce order change status. But as you can see this code hard to read. So my question is a "how can i make fix better for clean code ". Can you advice me for that? THX

Woocommerce order change status

This code can woocommerce order change status. But as you can see, this code is hard to read. How can I make it cleaner?

Source Link

How can i make this code much better for clean code?

This code can woocommerce order change status. But as you can see this code hard to read. So my question is a "how can i make fix better for clean code ". Can you advice me for that? THX

<?php

$tarih = explode('T', $order->get_date_completed());
$now = date("Y-m-d");
$origin = date_create($tarih[0]);
$target = date_create($now);
$interval = date_diff($origin, $target);
$iade_hakki=$interval->d;
$aide_yazi='';
?>
  <section class="woocommerce-columns woocommerce-columns--2 woocommerce-columns--addresses col2-set addresses">
    <div class="woocommerce-column woocommerce-column--1 woocommerce-column--billing-address col-1">
        <?php
        global $wp;
          $current_url = home_url(add_query_arg(array(), $wp->request));
        if ($order->get_status()=="completed") {
            if ($iade_hakki>=14){ ?>
            <?php } else{?>
                <button id="button-iade" data-id="<?=$order_id?>" style="border-radius: 4px;border:1px solid #92cecc; background-color: white;color:#92cecc" data-redirect="<?=$current_url?>" class="woocommerce-Button button woocommerce-column__title" >
                    Siparişi İade Et </button>
            <?php  }
        }
        elseif ($order->get_status()=='shipped'){ ?>

            <button id="button-iade" style="border-radius: 4px;border:1px solid #92cecc; background-color: white;color:#92cecc" data-id="<?=$order_id?>" data-redirect="<?=$current_url?>" class="woocommerce-Button button woocommerce-column__title" >
                Siparişi İade Et </button>
        <?php }
        else if ($order->get_status() == 'processing' || $order->get_status() == 'on-hold') {
            global $wp;
            $current_url = home_url(add_query_arg(array(), $wp->request));

            ?>

            <button id="button-iptal" style="border-radius: 4px;border:1px solid #92cecc; background-color: white;color:#92cecc" data-id="<?=$order_id?>" data-redirect="<?=$current_url?>" class="woocommerce-Button button woocommerce-column__title" >
                Siparişi İptal Et </button>

        <?php } else{
            echo '';
        }
        ?>