{"id":16108,"date":"2024-03-31T12:35:59","date_gmt":"2024-03-31T12:35:59","guid":{"rendered":"https:\/\/noblish.com\/shop\/?page_id=16108"},"modified":"2025-01-19T20:00:53","modified_gmt":"2025-01-19T20:00:53","slug":"custom","status":"publish","type":"page","link":"https:\/\/noblish.com\/shop\/custom\/","title":{"rendered":"Custom"},"content":{"rendered":"<p><script>\n\/\/ Integration by Smidyo\n\/\/ frank@smidyo.com\nwindow.addEventListener(\"ccloaded\", instance => {\n  const ccInstance = cc.getInstance(instance.detail.calculatorId);\n  ccInstance.calculator.on(\"submit\", async (response) => {\n    if(response.elementId !== \"maWXHD3hEKRMEajvk\") {\n      return;\n    }\n    const res = await fetch(\"\/shop\/wp-json\/wc\/store\/v1\/cart\/\");\n    const nonce = res.headers.get(\"Nonce\")\n    const body = await res.json();\n    \/\/ Uncomment if we wish to add a \"base cost\" to the cart.\n    \/\/ if(!body.items.some(i => i.id === xxx)) {\n    \/\/   await fetch(\n    \/\/     `\/shop\/wp-json\/wc\/store\/v1\/cart\/add-item?id=xxx&quantity=1`,\n    \/\/     { method: \"POST\", headers: { \"Nonce\": nonce }, credentials: \"same-origin\" }\n    \/\/   );\n    \/\/ }\n    const productId = cc.parsedFormulas.PRODID.result;\n    const quantity = cc.answers.QTY.value;\n    await fetch(\n      `\/shop\/wp-json\/wc\/store\/v1\/cart\/add-item?id=${productId}&quantity=${quantity}`,\n      { method: \"POST\", headers: { \"Nonce\": nonce }, credentials: \"same-origin\" }\n    );\n    window.location.href = '\/shop\/cart\/';\n  });\n});\n<\/script><br \/>\n\n    <div class=\"calculator\" data-calc-id=\"DhhbxZTx2mTptRxyq\" data-type=\"in-page\"><\/div>\n    <script src=\"https:\/\/www.convertcalculator.com\/scripts\/embed.js\" async=\"true\"><\/script>\n  <\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-16108","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/noblish.com\/shop\/wp-json\/wp\/v2\/pages\/16108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/noblish.com\/shop\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/noblish.com\/shop\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/noblish.com\/shop\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/noblish.com\/shop\/wp-json\/wp\/v2\/comments?post=16108"}],"version-history":[{"count":7,"href":"https:\/\/noblish.com\/shop\/wp-json\/wp\/v2\/pages\/16108\/revisions"}],"predecessor-version":[{"id":16128,"href":"https:\/\/noblish.com\/shop\/wp-json\/wp\/v2\/pages\/16108\/revisions\/16128"}],"wp:attachment":[{"href":"https:\/\/noblish.com\/shop\/wp-json\/wp\/v2\/media?parent=16108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}