-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathorder-details.php
102 lines (81 loc) · 3.17 KB
/
order-details.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
defined( 'ABSPATH' ) || exit;
$order = wc_get_order( $order_id ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
if ( ! $order ) {
return;
}
$order_items = $order->get_items( apply_filters( 'woocommerce_purchase_order_item_types', 'line_item' ) );
$show_purchase_note = $order->has_status( apply_filters( 'woocommerce_purchase_note_order_statuses', array( 'completed', 'processing' ) ) );
$show_customer_details = is_user_logged_in() && $order->get_user_id() === get_current_user_id();
$downloads = $order->get_downloadable_items();
$show_downloads = $order->has_downloadable_item() && $order->is_download_permitted();
if ( $show_downloads ) {
wc_get_template(
'order/order-downloads.php',
array(
'downloads' => $downloads,
'show_title' => true,
)
);
}
?>
<?php
do_action( 'woocommerce_order_details_before_order_table_items', $order );
foreach ( $order_items as $item_id => $item ) {
$product = $item->get_product();
wc_get_template(
'order/order-details-item.php',
array(
'order' => $order,
'item_id' => $item_id,
'item' => $item,
'show_purchase_note' => $show_purchase_note,
'purchase_note' => $product ? $product->get_purchase_note() : '',
'product' => $product,
)
);
$Produtos .= "*".$item->get_quantity()."x* ".$item->get_name()."%0a%0a";
$soma += $item->get_total();
}
do_action( 'woocommerce_order_details_after_order_table_items', $order );
foreach ($order->meta_data as $valor) {
if($valor->key == "_billing_numero"){
//$numero = $count->value;
$numero = $valor->value;
}
if($valor->key == "_billing_complemento"){
$complemento = $valor->value;
}
if($valor->key == "_billing_pagamento"){
$pagamento = $valor->value;
}
if($valor->key == "_billing_observacoes"){
$obs = $valor->value;
}
}
//$dados .= "*ORÇAMENTO ENVIADO%0a*";
$dados .= "*MISSVENUS ORÇAMENTO ENVIADO*%0a*";
$dados .= "----------------------------------------%0a";
//$dados .= "*RESUMO DO ORÇAMENTO*%0a";
$dados .= "*RESUMO DO ORÇAMENTO*%0a%0a";
//$dados .= "Cód".$order->get_id()."%0a%0a";
$dados .= "Cód: ".$order->get_id()."%0a%0a";
$dados .= "*PRODUTOS*%0a%0a";
$dados .= $Produtos ;
$dados .= "----------------------------------------%0a";
$dados .= "*SUBTOTAL* R$".number_format($soma,2,',','.')."%0a%0a";
$dados .= "----------------------------------------%0a";
$dados .= "*DADOS DO CLIENTE%0a*";
$dados .= "*Nome:* ".$order->get_billing_first_name()." ".$order->get_billing_last_name()."%0a";
$dados .= "*Endereço:* ".$order->get_billing_address_1()." , ".$numero." %0a";
$dados .= "*Cep:* ".$order->get_billing_postcode()." %0a";
$dados .= "*Cidade:* ".$order->get_billing_city()." %0a";
$dados .= "*Bairro:* ".$order->get_billing_address_2()." %0a";
$dados .= "*Complemento:* ".$complemento." %0a";
$dados .= "*Telefone/WhatsApp* ".$order->get_billing_phone()." %0a";
$dados .= "*TOTAL:* = R$ " .number_format($order ->get_total(),2,",",".")." %0a";
$dados .= "*Pagamento* ".$pagamento." %0a";
$dados .= "*Observações:* ".$obs." %0a";
$telefone = WHATSAPP;
header("Location: https://api.whatsapp.com/send?phone=".$telefone."&text=".$dados);
?>