Personalized checkout and custom promotions with Shopify Scripts
Hi,
I have a javascript code that retrieves order data to Google Sheets.
It works fine except that the "properties" output comes in one cell like this:
{name=Date, value=7 February 2023}
How to get the value of "properties" without the name or the brackets?
I am not sure about the script, so I am open to any recommendations.
Thanks.
script:
const data = orders.reduce((acc, order) => {
const lineItems = order["line_items"].map(item => {
return [
item["id"],
item["title"],
item["quantity"],
item["price"],
item["properties"], ## This one
order["created_at"],
order["total_price"],
order["customer"],
];
});
return acc.concat(lineItems);
}, []);
Solved! Go to the solution
This is an accepted solution.
Thanks for your response, I've just figured it out.
For anyone looking for the same thing, here's what worked with me to retrieve the custom property value:
item["properties"] ? item["properties"].map(property => property.value).join(", ") : "",
I think, it is a javascript object and you have to manipulate it separately
This is an accepted solution.
Thanks for your response, I've just figured it out.
For anyone looking for the same thing, here's what worked with me to retrieve the custom property value:
item["properties"] ? item["properties"].map(property => property.value).join(", ") : "",
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024