Hi everyone
Sorry for asking this kind of basic question but I am lost …
I am getting below JSON from Woocommerce when calling orders.
Now I would like to extract the value of …
"meta_data": [
...
{
"id": 240604,
"key": "lastorderpaid",
"value": "Ja"
}
...
]
The id changes in every order, so I need to extract the value “Ja” or “Nein” by using the key “lastorderpaid” but I do not understand how to access that.
I would very much appreciate any help in solving this.
Thank you all in advance.
Kind regards
Harald
[
{
"id": 18883,
"parent_id": 0,
"status": "completed",
"currency": "CHF",
"version": "6.7.0",
"prices_include_tax": true,
"date_created": "2022-03-15T21:18:34",
"date_modified": "2022-08-08T20:55:50",
"discount_total": "27.85",
"discount_tax": "0.00",
"shipping_total": "3.90",
"shipping_tax": "0.00",
"cart_tax": "0.00",
"total": "0.00",
"total_tax": "0.00",
"customer_id": 1164,
"order_key": "wc_order_fwVDDCxeItzCy",
"billing": {
"first_name": "****",
"last_name": "*****",
"company": "",
"address_1": "******strasse **",
"address_2": "",
"city": "****",
"state": "",
"postcode": "*",
"country": "AT",
"email": "*****@gmail.com",
"phone": "+41 ** *** ** **",
"billing_anrede": "Herr"
},
"shipping": {
"first_name": "******",
"last_name": "******",
"company": "",
"address_1": "******",
"address_2": "",
"city": "******",
"state": "SZ",
"postcode": "******",
"country": "CH",
"phone": "",
"shipping_anrede": "Herr"
},
"payment_method": "",
"payment_method_title": "",
"transaction_id": "",
"customer_ip_address": "213.163.245.161",
"customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36 Edg/99.0.1150.39",
"created_via": "checkout",
"customer_note": "",
"date_completed": "2022-05-29T21:51:44",
"date_paid": "2022-03-15T21:18:34",
"cart_hash": "89dbfe7222e2f3284a206529f670e29c",
"number": "18883",
"meta_data": [
{
"id": 240546,
"key": "mailchimp_woocommerce_campaign_id",
"value": ""
},
{
"id": 240547,
"key": "mailchimp_woocommerce_landing_site",
"value": "https://shop.stofftaschentuch.ch/"
},
{
"id": 240580,
"key": "_billing_anrede",
"value": "Herr"
},
{
"id": 240581,
"key": "_shipping_anrede",
"value": "Frau"
},
{
"id": 240582,
"key": "is_vat_exempt",
"value": "no"
},
{
"id": 240583,
"key": "_woo_vou_multiple_pdf",
"value": {
"1761": "yes"
}
},
{
"id": 240592,
"key": "thwcfe_ship_to_billing",
"value": "0"
},
{
"id": 240600,
"key": "_new_order_email_sent",
"value": "true"
},
{
"id": 240601,
"key": "_ga_tracked",
"value": "1"
},
{
"id": 240604,
"key": "lastorderpaid",
"value": "Ja"
},
{
"id": 240605,
"key": "Hinweis",
"value": "************"
},
{
"id": 240606,
"key": "billing_anrede",
"value": "Herr"
},
{
"id": 240607,
"key": "shipping_anrede",
"value": "Herr"
},
{
"id": 240608,
"key": "_at_widget",
"value": "1"
},
{
"id": 240900,
"key": "wf_invoice_number",
"value": "18883"
},
{
"id": 240901,
"key": "_wf_invoice_date",
"value": "1647546032"
},
{
"id": 240902,
"key": "_woo_vou_recipient_email_sent",
"value": "1"
}
],
"line_items": [
{
"id": 8619,
"name": "Naturbursche | Herren [3er Set] - Standard",
"product_id": 1761,
"variation_id": 1762,
"quantity": 1,
"tax_class": "",
"subtotal": "23.95",
"subtotal_tax": "0.00",
"total": "0.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 59121,
"key": "pa_ausfuehrung",
"value": "standard",
"display_key": "Ausführung",
"display_value": "Standard"
},
{
"id": 59131,
"key": "_reduced_stock",
"value": "1",
"display_key": "_reduced_stock",
"display_value": "1"
},
{
"id": 59172,
"key": "_woo_vou_recipient_gift_email_send_item",
"value": "no",
"display_key": "_woo_vou_recipient_gift_email_send_item",
"display_value": "no"
}
],
"sku": "15.0808-S",
"price": 0,
"image": {
"id": 14461,
"src": "https://shop.stofftaschentuch.ch/wp-content/uploads/2020/07/******"
},
"parent_name": "Naturbursche | Herren [3er Set]"
}
],
"tax_lines": [],
"shipping_lines": [
{
"id": 8620,
"method_title": "Zero Waste Economy (ohne Kunststoffverpackung, lose im Versandkarton)",
"method_id": "flat_rate",
"instance_id": "3",
"total": "3.90",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 59127,
"key": "Positionen",
"value": "Naturbursche | Herren [3er Set] - Standard × 1",
"display_key": "Positionen",
"display_value": "Naturbursche | Herren [3er Set] - Standard × 1"
}
]
}
],
"fee_lines": [],
"coupon_lines": [
{
"id": 8621,
"code": "50-stota#qrh1o",
"discount": "27.85",
"discount_tax": "0",
"meta_data": [
{
"id": 59130,
"key": "coupon_data",
"value": {
"id": 18882,
"code": "************",
"amount": "50",
"status": "publish",
"date_created": {
"date": "2022-03-15 21:13:25.000000",
"timezone_type": 3,
"timezone": "Europe/Zurich"
},
"date_modified": {
"date": "2022-03-15 21:13:25.000000",
"timezone_type": 3,
"timezone": "Europe/Zurich"
},
"date_expires": {
"date": "2027-03-15 21:13:20.000000",
"timezone_type": 3,
"timezone": "Europe/Zurich"
},
"discount_type": "fixed_cart",
"description": "",
"usage_count": 0,
"individual_use": false,
"product_ids": [],
"excluded_product_ids": [],
"usage_limit": 0,
"usage_limit_per_user": 0,
"limit_usage_to_x_items": null,
"free_shipping": false,
"product_categories": [],
"excluded_product_categories": [],
"exclude_sale_items": false,
"minimum_amount": "",
"maximum_amount": "",
"email_restrictions": [],
"virtual": false,
"meta_data": [
{
"id": 240524,
"key": "_woo_vou_start_date",
"value": "2022-03-15 21:13:20"
},
{
"id": 240526,
"key": "_woo_vou_disable_redeem_day",
"value": ""
},
{
"id": 240527,
"key": "apply_before_tax",
"value": "yes"
},
{
"id": 240529,
"key": "_woo_vou_coupon_type",
"value": "voucher_code"
},
{
"id": 240530,
"key": "_woo_vou_order_id",
"value": "18880"
},
{
"id": 240535,
"key": "_woo_vou_discount_on_tax_type",
"value": "total"
}
]
},
"display_key": "coupon_data",
"display_value": {
"id": 18882,
"code": "50-stota#qrh1o",
"amount": "50",
"status": "publish",
"date_created": {
"date": "2022-03-15 21:13:25.000000",
"timezone_type": 3,
"timezone": "Europe/Zurich"
},
"date_modified": {
"date": "2022-03-15 21:13:25.000000",
"timezone_type": 3,
"timezone": "Europe/Zurich"
},
"date_expires": {
"date": "2027-03-15 21:13:20.000000",
"timezone_type": 3,
"timezone": "Europe/Zurich"
},
"discount_type": "fixed_cart",
"description": "",
"usage_count": 0,
"individual_use": false,
"product_ids": [],
"excluded_product_ids": [],
"usage_limit": 0,
"usage_limit_per_user": 0,
"limit_usage_to_x_items": null,
"free_shipping": false,
"product_categories": [],
"excluded_product_categories": [],
"exclude_sale_items": false,
"minimum_amount": "",
"maximum_amount": "",
"email_restrictions": [],
"virtual": false,
"meta_data": [
{
"id": 240524,
"key": "_woo_vou_start_date",
"value": "2022-03-15 21:13:20"
},
{
"id": 240526,
"key": "_woo_vou_disable_redeem_day",
"value": ""
},
{
"id": 240527,
"key": "apply_before_tax",
"value": "yes"
},
{
"id": 240529,
"key": "_woo_vou_coupon_type",
"value": "voucher_code"
},
{
"id": 240530,
"key": "_woo_vou_order_id",
"value": "18880"
},
{
"id": 240535,
"key": "_woo_vou_discount_on_tax_type",
"value": "total"
}
]
}
}
]
}
],
"refunds": [],
"payment_url": "https://shop.stofftaschentuch.ch/kasse/bestellung-bezahlen/18883/?pay_for_order=true&key=******",
"is_editable": false,
"needs_payment": false,
"needs_processing": true,
"date_created_gmt": "2022-03-15T20:18:34",
"date_modified_gmt": "2022-08-08T18:55:50",
"date_completed_gmt": "2022-05-29T19:51:44",
"date_paid_gmt": "2022-03-15T20:18:34",
"frage_1": {
"additional_aufmerksam": "Suchmaschinen"
},
"currency_symbol": "CHF",
"_links": {
"self": [
{
"href": "https://shop.stofftaschentuch.ch/******"
}
],
"collection": [
{
"href": "https://shop.stofftaschentuch.ch/******"
}
],
"customer": [
{
"href": "https://shop.stofftaschentuch.ch/************"
}
]
}
}
]
Information on your n8n setup
- n8n version: 0.189.1
- Running n8n via [Docker]: