На сайте wordpress c использованием плагина woocomerce в момент формирования заказа я получаю переменную
$items = $order->get_items(); (это детали заказа)
Переменная $items Содержит
{"id":208,"order_id":661,"name":"Комплект документов","product_id":594,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"0","subtotal_tax":"0","total":"0","total_tax":"0","taxes":
{"total":[],"subtotal":[]},
"meta_data":[{"id":2385,"key":"woosb_ids","value":"419/0,435/0,419/0,435/0,423/0,423/0,423/1,437/0,437/0,435/0,426/0,435/0,426/0,434/0,434/0,426/0,435/0,434/0,426/0,434/1,423/0"},
{"id":2386,"key":"Фaйл(ы)","value":"https://bezopasno.org/uploads/010-egrn-obekt-moskva-r-n-mozhajskij-sh-mozhajskoe-d-45-korp-1-kv-387_1540975609.pdf; https://bezopasno.org/uploads/paymentreport_1540975613.pdf; https://bezopasno.org/uploads/va2chairzby_1540975618.jpg;"},
{"id":2387,"key":"Объект","value":"Москвa, ул. Неизвесная 123"},
{"id":2388,"key":"Кв.","value":"4444"},
{"id":2389,"key":"Доп.","value":"99999999999"},
{"id":2390,"key":"Собс.-1","value":"Пупкин 11111"},
{"id":2391,"key":"Собс.-2","value":"Пупкин 2222222222"},
{"id":2392,"key":"Собс.-3","value":"Пупкин 33333333"},
{"id":2393,"key":"Собс.-4","value":"Пупкин 44444444444"},
{"id":2394,"key":"Собс.-5","value":"Пупкин 55555555555"}]},
{"id":209,"order_id":661,"name":"Электроннaя выпискa из ЕГРН","product_id":423,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"1","subtotal_tax":"0","total":"1","total_tax":"0","taxes":
{"total":[],"subtotal":[]},
"meta_data":[{"id":2404,"key":"woosb_parent_id","value":"594"}]},
{"id":210,"order_id":661,"name":"ПНД НД МО","product_id":434,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"5500","subtotal_tax":"0","total":"5500","total_tax":"0","taxes":
{"total":[],"subtotal":[]},
"meta_data":[{"id":2414,"key":"woosb_parent_id","value":"594"}]},
{"id":211,"order_id":661,"name":"Комплект документов","product_id":594,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"0","subtotal_tax":"0","total":"0","total_tax":"0","taxes":
{"total":[],"subtotal":[]},
"meta_data":[{"id":2424,"key":"woosb_ids","value":"419/0,435/0,419/0,435/1,423/0,423/0,423/0,437/0,437/0,435/0,426/0,435/0,426/1,434/0,434/0,426/0,435/0,434/0,426/0,434/0,423/0"},
{"id":2425,"key":"Фaйл(ы)","value":"https://eee.org/uploads/va2chairzby-1-_1540975698.jpg; https://eee.org/uploads/014-egrp-arh_moskovskaya-oblast-g.shhelkovo-mikrorajon-bogorodskij-d.17-kv.77_1540975703.pdf; https://eee.org/uploads/010-egrn-obekt-moskovskaya-oblast-shhelkovskij-r-n-g-shhelkovo-mkr-bogorodskij-d-17-pom-77_1540975708.pdf;"},
{"id":2426,"key":"Объект","value":"Москвa, ул. Нужная 4, 50 этaж"},
{"id":2427,"key":"Кв.","value":"9999"},
{"id":2428,"key":"Доп.","value":"235йцукефцу45й3"},
{"id":2429,"key":"Собс.-1","value":"Смирнов 1111111"},
{"id":2430,"key":"Собс.-2","value":"Смирнов 222222222222"},
{"id":2431,"key":"Собс.-3","value":"Смирнов 333333333333"},
{"id":2432,"key":"Собс.-4","value":"Смирнов 44444444444"},
{"id":2433,"key":"Собс.-5","value":"Смирнов 555555555555"}]},
{"id":212,"order_id":661,"name":"ПНД НД МСК","product_id":435,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"3500","subtotal_tax":"0","total":"3500","total_tax":"0","taxes":
{"total":[],"subtotal":[]},
"meta_data":[{"id":2443,"key":"woosb_parent_id","value":"594"}]},
{"id":213,"order_id":661,"name":"Комплекснaя проверкa продaвцa","product_id":426,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"5500","subtotal_tax":"0","total":"5500","total_tax":"0","taxes":
{"total":[],"subtotal":[]},
"meta_data":[{"id":2453,"key":"woosb_parent_id",
Ка мне правильно вытащить данные самого заказа для дальнейшей обработки
именно соседние элементы (если я правильно понимаю) именно pначение определенных "value"
Должно получится что то вроде:
Из
{"id":2386,"key":"Фaйл(ы)","value":"https://eee.org/uploads/va2chairzby-1-_1540975698.jpg; https://eee.org/uploads/014-egrp-arh...540975703.pdf; https://eee.org/uploads/010-egrn-obekt-moskovskaya-oblast-shhelkovskij-r-n-g-shhelkovo-mkr-bogorodskij-d-17-pom-77_1540975708.pdf;"}
получить
$dow_file = "https://eee.org/uploads/va2chairzby-1-_1540975698.jpg; https://eee.org/uploads/014-egrp-arh...540975703.pdf; https://eee.org/uploads/010-egrn-obekt-moskovskaya-oblast-shhelkovskij-r-n-g-shhelkovo-mkr-bogorodskij-d-17-pom-77_1540975708.pdf;"
из
{"id":2387,"key":"Объект","value":"Москвa, ул. Неизвесная 123"}
получить
$input_obj_name = "Москвa, ул. Неизвесная 123"
из
{"id":2388,"key":"Кв.","value":"4444"}
получить
$input_obj_flat = "4444"
из
{"id":2389,"key":"Доп.","value":"99999999999"}
получить
$input_obj_kad = "99999999999"
и т.д.
(значение "id" конечно же каждый раз разные)