Answer the question
In order to leave comments, you need to log in
How to get POST-REQUEST response in JSON format and change order details in WooCommerce?
There is the following code:
function check_ipn_response(){
global $woocommerce;
if (isset($_GET['dastavista']) AND $_GET['dastavista'] == 'success'){
//Получаем принятые данные в формате JSON
$jsone = json_decode(file_get_contents("php://input"), true);
//Проверяем имеются ли какие либо данные
if(isset($jsone)){
//Извлекаем статус транзакции из JSON
$order_status = $jsone->status;
//Извлекаем ID заказа из JSON
$order_info = $jsone->OrderId;
//Извлекаем Номер телефона клиента из JSON
$customer_info = $jsone->ClientPhone;
//Выполняем события (тут получается только одно статус заказа меняется на - выполнено)
$update_order_id = (int)$order_info;
$order_object = wc_get_order($update_order_id);
$order_object->update_status('completed');
WC()->cart->empty_cart();
wp_redirect( $this->get_return_url( $order ) );
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question