Jump to content

Manuciao

Member
  • Posts

    2
  • Joined

  • Last visited

Manuciao's Achievements

Level 1

Level 1 (1/20)

0

Reputation

  1. hi @paul2009 Thank you for the detailed response! I understand that it’s not possible to programmatically add custom data to order via the cart or checkout page due to the limitations you mentioned regarding the locked-down nature of the checkout process. I also appreciate the clarification about the cart page not having access to the checkout details for transferring data directly into the order. Your suggestion about using a Custom Product Form to capture and pass additional data to an order is very helpful. While it’s not exactly what I was hoping for, I will definitely explore this option. I can see how a custom product form might help in certain situations, although it would need to be tied to individual products, which isn’t ideal in my case, as I was aiming to capture a geolocation (what3words address) relevant to delivery, not a product-specific input. To give you more context, I’m working with the what3words service to capture precise delivery addresses at checkout. The goal is to pass this location data along with the order so it can be used by carriers or integrated into an order management system. Given that the checkout page cannot be modified and the cart page approach won’t allow me to pass this data, I’m curious if there are other potential workarounds. For instance, is there any way to store a custom input from the cart page (using something like the what3words AutoSuggest component) and send it to the order’s Additional Info or Notes field via the Orders API? This could help ensure the data is still passed through the backend. I appreciate any further insights you may have, and thanks again for the suggestion about the Custom Product Form!
  2. Hi Squarespace Community, I’m looking for a way to add a custom field to the checkout page (preferably) or the cart page, in case the checkout page can’t be modified. My goal is to use this field to capture a what3words address (a geolocation tool that helps pinpoint precise delivery locations) and pass this information to the order’s Notes or Additional Information field when the order is submitted. I know that it’s possible to inject custom code into the cart page by adding it to the header or footer of the full site. Here’s the code snippet I’m using to add the What3Words component to the cart page: <script> document.addEventListener('DOMContentLoaded', function() { if (window.location.pathname.includes('/cart')) { const scriptModule = document.createElement('script'); scriptModule.type = 'module'; scriptModule.src = 'https://cdn.what3words.com/javascript-components@4-latest/dist/what3words/what3words.esm.js'; document.head.appendChild(scriptModule); const scriptNoModule = document.createElement('script'); scriptNoModule.nomodule = true; scriptNoModule.src = 'https://cdn.what3words.com/javascript-components@4-latest/dist/what3words/what3words.js'; document.head.appendChild(scriptNoModule); scriptModule.onload = scriptNoModule.onload = function() { const w3wContainer = document.createElement('div'); w3wContainer.innerHTML = ` <label for="w3w-address">What3Words Address (optional)</label> <what3words-autosuggest api_key="YOUR-API-KEY"> <input autocomplete="off" type="text" id="w3w-address" name="what3words_address" placeholder="e.g. filled.count.soap"> </what3words-autosuggest> `; w3wContainer.style.margin = "20px 0"; const checkoutButton = document.querySelector('.cart-checkout-button'); if (checkoutButton) { checkoutButton.parentNode.insertBefore(w3wContainer, checkoutButton); } }; } }); </script> The component works on the cart page to capture the what3words address using the what3words AutoSuggest Component, but I’m unsure how to pass the value from this field to the order’s Additional Info or Notes field. Ideally, I’d like to pass the selected what3words address to the order summary once the customer checks out. Questions: 1. Is there a way to send data from a custom field on the cart page to the order’s Additional Info or Notes section? 2. If the cart page approach is the best option, can I grab the What3Words address from this input field and ensure it gets submitted as part of the order? 3. Is there any method or workaround for achieving this directly on the checkout page itself? Thanks in advance for your help!
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.