<?php
$order_id = $_GET['order_id'];
global $order;
if (isset($_GET['order_id'])){
$order = new WC_Order($order_id);
}
// check weather the elementor editor is active
// url contains wp-admin and post id is set
$is_elementor_editor = false;
if (isset($_GET['post'] ) && strpos($_SERVER['REQUEST_URI'], '/wp-admin') !== false){
$is_elementor_editor = true;
}
if (!is_admin() && (!isset($_GET['order_id']) || !$order)){
// 404 redirect
while (ob_get_level()) {
ob_end_clean();
}
wp_redirect(home_url());
}
<?php
global $order;
function get_order_status_batch($status){
$batch_class = '';
switch($status){
case 'completed':
$batch_class = 'success';
break;
case 'processing':
$batch_class = 'primary';
break;
case 'on-hold':
$batch_class = 'warning';
break;
case 'pending':
$batch_class = 'info';
break;
case 'cancelled':
$batch_class = 'danger';
break;
case 'refunded':
$batch_class = 'danger';
break;
case 'failed':
$batch_class = 'danger';
break;
default:
$batch_class = 'secondary';
break;
}
return "order-status order-status-" . $batch_class;
}
?>
<div>
<div class="d-flex" style="gap: 2rem;">
<div class="mobile-span-2">
<div class="d-flex align-items-center mb-3">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path d="M17.6201 9.61914H12.3701C11.9601 9.61914 11.6201 9.27914 11.6201 8.86914C11.6201 8.45914 11.9601 8.11914 12.3701 8.11914H17.6201C18.0301 8.11914 18.3701 8.45914 18.3701 8.86914C18.3701 9.27914 18.0401 9.61914 17.6201 9.61914Z" fill="#292D32"/>
<path d="M7.12006 10.3803C6.93006 10.3803 6.74006 10.3103 6.59006 10.1603L5.84006 9.41031C5.55006 9.12031 5.55006 8.64031 5.84006 8.35031C6.13006 8.06031 6.61006 8.06031 6.90006 8.35031L7.12006 8.57031L8.84006 6.85031C9.13006 6.56031 9.61006 6.56031 9.90006 6.85031C10.1901 7.14031 10.1901 7.62031 9.90006 7.91031L7.65006 10.1603C7.51006 10.3003 7.32006 10.3803 7.12006 10.3803Z" fill="#292D32"/>
<path d="M17.6201 16.6191H12.3701C11.9601 16.6191 11.6201 16.2791 11.6201 15.8691C11.6201 15.4591 11.9601 15.1191 12.3701 15.1191H17.6201C18.0301 15.1191 18.3701 15.4591 18.3701 15.8691C18.3701 16.2791 18.0401 16.6191 17.6201 16.6191Z" fill="#292D32"/>
<path d="M7.12006 17.3803C6.93006 17.3803 6.74006 17.3103 6.59006 17.1603L5.84006 16.4103C5.55006 16.1203 5.55006 15.6403 5.84006 15.3503C6.13006 15.0603 6.61006 15.0603 6.90006 15.3503L7.12006 15.5703L8.84006 13.8503C9.13006 13.5603 9.61006 13.5603 9.90006 13.8503C10.1901 14.1403 10.1901 14.6203 9.90006 14.9103L7.65006 17.1603C7.51006 17.3003 7.32006 17.3803 7.12006 17.3803Z" fill="#292D32"/>
<path d="M15 22.75H9C3.57 22.75 1.25 20.43 1.25 15V9C1.25 3.57 3.57 1.25 9 1.25H15C20.43 1.25 22.75 3.57 22.75 9V15C22.75 20.43 20.43 22.75 15 22.75ZM9 2.75C4.39 2.75 2.75 4.39 2.75 9V15C2.75 19.61 4.39 21.25 9 21.25H15C19.61 21.25 21.25 19.61 21.25 15V9C21.25 4.39 19.61 2.75 15 2.75H9Z" fill="#292D32"/>
</svg>
<h6>Order Details</h6>
</div>
<div class="mb-2"><strong>Order ID:</strong> #<?php echo $order->get_id(); ?></div>
<div class="mb-2"><strong>Order Status:</strong> <span class="<?php echo get_order_status_batch($order->get_status()); ?>"> <?php echo wc_get_order_status_name($order->get_status()); ?></span></div>
<div class="mb-2"><strong>Order Date:</strong> <?php echo $order->get_date_created()->date('Y-m-d'); ?></div>
<div class="mb-2"><strong>Order Total:</strong> $<?php echo $order->get_total(); ?></div>
</div>
<div>
<div class="d-flex align-items-center mb-3">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path d="M11.9999 14.1695C9.86988 14.1695 8.12988 12.4395 8.12988 10.2995C8.12988 8.15945 9.86988 6.43945 11.9999 6.43945C14.1299 6.43945 15.8699 8.16945 15.8699 10.3095C15.8699 12.4495 14.1299 14.1695 11.9999 14.1695ZM11.9999 7.93945C10.6999 7.93945 9.62988 8.99945 9.62988 10.3095C9.62988 11.6195 10.6899 12.6795 11.9999 12.6795C13.3099 12.6795 14.3699 11.6195 14.3699 10.3095C14.3699 8.99945 13.2999 7.93945 11.9999 7.93945Z" fill="#292D32"/>
<path d="M12.0002 22.76C10.5202 22.76 9.03018 22.2 7.87018 21.09C4.92018 18.25 1.66018 13.72 2.89018 8.33C4.00018 3.44 8.27018 1.25 12.0002 1.25C12.0002 1.25 12.0002 1.25 12.0102 1.25C15.7402 1.25 20.0102 3.44 21.1202 8.34C22.3402 13.73 19.0802 18.25 16.1302 21.09C14.9702 22.2 13.4802 22.76 12.0002 22.76ZM12.0002 2.75C9.09018 2.75 5.35018 4.3 4.36018 8.66C3.28018 13.37 6.24018 17.43 8.92018 20C10.6502 21.67 13.3602 21.67 15.0902 20C17.7602 17.43 20.7202 13.37 19.6602 8.66C18.6602 4.3 14.9102 2.75 12.0002 2.75Z" fill="#292D32"/>
</svg>
<h6>Shipping Address</h6>
</div>
<?php
$shipping = $order->get_address('shipping');
echo "
<div>{$shipping['first_name']} {$shipping['last_name']}</div>
<div>{$shipping['address_1']}</div>
<div>{$shipping['address_2']}</div>
<div>{$shipping['city']}, {$shipping['postcode']},</div>
<div>{$shipping['state']}, {$shipping['country']}</div>
<div>{$shipping['phone']}</div>";
?>
</div>
<div>
<div class="d-flex align-items-center mb-3">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path d="M11.9999 14.1695C9.86988 14.1695 8.12988 12.4395 8.12988 10.2995C8.12988 8.15945 9.86988 6.43945 11.9999 6.43945C14.1299 6.43945 15.8699 8.16945 15.8699 10.3095C15.8699 12.4495 14.1299 14.1695 11.9999 14.1695ZM11.9999 7.93945C10.6999 7.93945 9.62988 8.99945 9.62988 10.3095C9.62988 11.6195 10.6899 12.6795 11.9999 12.6795C13.3099 12.6795 14.3699 11.6195 14.3699 10.3095C14.3699 8.99945 13.2999 7.93945 11.9999 7.93945Z" fill="#292D32"/>
<path d="M12.0002 22.76C10.5202 22.76 9.03018 22.2 7.87018 21.09C4.92018 18.25 1.66018 13.72 2.89018 8.33C4.00018 3.44 8.27018 1.25 12.0002 1.25C12.0002 1.25 12.0002 1.25 12.0102 1.25C15.7402 1.25 20.0102 3.44 21.1202 8.34C22.3402 13.73 19.0802 18.25 16.1302 21.09C14.9702 22.2 13.4802 22.76 12.0002 22.76ZM12.0002 2.75C9.09018 2.75 5.35018 4.3 4.36018 8.66C3.28018 13.37 6.24018 17.43 8.92018 20C10.6502 21.67 13.3602 21.67 15.0902 20C17.7602 17.43 20.7202 13.37 19.6602 8.66C18.6602 4.3 14.9102 2.75 12.0002 2.75Z" fill="#292D32"/>
</svg>
<h6>Billing Address</h6>
</div>
<?php
$billing = $order->get_address('billing');
echo "
<div>{$billing['first_name']} {$billing['last_name']}</div>
<div>{$billing['address_1']}</div>
<div>{$billing['address_2']}</div>
<div>{$billing['city']}, {$billing['postcode']},</div>
<div>{$billing['state']}, {$billing['country']}</div>
<div>{$billing['phone']}</div>";
?>
</div>
</div>
</div>
<div class="order-user-actions">
<?php
$actions = wc_get_account_orders_actions( $order );
// remove view key from actions
if ( ! empty( $actions ) ) {
foreach ( $actions as $key => $action ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
if ( $key === 'view' || $key === 'cancel' ) {
continue;
}
echo '<a href="' . esc_url( $action['url'] ) . '" class="button ' . sanitize_html_class( $key ) . '">' . esc_html( $action['name'] ) . '</a>';
}
}
?>
</div>
<?php
// checking for the user's email is confirmed and has a valid license
$out_message = "";
if (!ULMUserControls::IsEmailConfirmed()){
$out_message = "Please confirm your email address before purchase anything.";
} else if (!ULMUserControls::HasValidLicense()){
//no valid license
//check license state
if (!ULMUserControls::$has_license){
$out_message = "You don't have a valid license. Please upload your license before purchase anything.";
}else if (ULMUserControls::$license->license_status == ULMLicense::STATUS_PENDING){
$out_message = "Your license is pending. Please wait until your license is approved.";
}else if (ULMUserControls::$license->license_status == ULMLicense::STATUS_REJECTED){
$out_message = "Your license is rejected. Please upload a valid license before purchase anything.";
}else if (ULMUserControls::$license->license_status == ULMLicense::STATUS_EXPIRED){
$out_message = "Your license is expired. Please upload a valid license before purchase anything.";
}
}
if (!empty($out_message)): ?>
<script>
document.addEventListener("DOMContentLoaded", function(){
setTimeout(() => {
show_toast("<?php echo $out_message; ?>", "warning", 10000);
}, 3000);
});
</script>
<?php endif; ?>