diff --git a/XMLtoGraphQL/script.js b/XMLtoGraphQL/script.js index e56e28f..5f52e05 100644 --- a/XMLtoGraphQL/script.js +++ b/XMLtoGraphQL/script.js @@ -1,11 +1,11 @@ function idmGetGrossNetPrices({priceNode, name}){ return { gross: { - value: priceNode?.getAttribute(`${name}`) !== null ? +priceNode.getAttribute(`${name}`) : undefined, + value: priceNode?.getAttribute(`${name}`) !== null ? +priceNode?.getAttribute(`${name}`) : undefined, formatted: priceNode?.getAttribute(`${name}_formatted`) ?? undefined, }, net: { - value: priceNode?.getAttribute(`${name}_net`) !== null ? +priceNode.getAttribute(`${name}_net`) : undefined, + value: priceNode?.getAttribute(`${name}_net`) !== null ? +priceNode?.getAttribute(`${name}_net`) : undefined, formatted: priceNode?.getAttribute(`${name}_net_formatted`) ?? undefined, } } @@ -193,7 +193,7 @@ async function idmGetGraphQLData(link){ sizesNode.querySelectorAll(":scope > size").forEach(size=>{ const availabilityNode = size.querySelector(":scope > availability"); const shippingTimeNode = availabilityNode.querySelector(":scope > shipping_time"); - const sizePriceNode = availabilityNode.querySelector(":scope > price"); + const sizePriceNode = size.querySelector(":scope > price"); const weightNode = size.querySelector(":scope > weight"); sizes.push({