Use GoDaddy Online Store to manage Foxy products

Delete

As soon as you make the following changes and publish, they will be live, so you may want to duplicate your GoDaddy site and test or have Foxy already configured. 

Requirements

  • A Foxy store (sign up here if you don't have one yet)
  • A GoDaddy website with the Online Store add-on

Integrate with Foxy


  1. In the GoDaddy website editor, go to the Shop page
  2. Below the section that displays products, add a new section
  3. Search for the HTML section and click the Add button to embed custom code on the page

  4. In the Custom Code textarea, copy/paste the code below:

    <script>
      setInterval(function () {
        const foxySubdomain = "YOUR_STORE";
        const addToCartBtn = parent.document.getElementById("addtocart-btn");
    
        if (!!addToCartBtn) {
          const name = parent.document.querySelector("[data-aid='PRODUCT_NAME_RENDERED']").innerText;
          const price = parent.document.querySelector("[data-aid='PRODUCT_PRICE_RENDERED']").innerText;
          const quantity = parent.document.querySelector("[data-aid='PRODUCT_QUANTITY']").value;
          const image = parent.document.querySelector("img").src;
    
          const variantSelect = parent.document.querySelectorAll("select");
          let variantParam = "";
    
          if (variantSelect.length > 0) {
            const allVariantName = Array.from(variantSelect).map(
              (variant) => variant.parentElement.previousElementSibling.innerHTML
            );
            const allVariantValue = Array.from(variantSelect).map(
              (variant) => variant.options[variant.selectedIndex].text
            );
    
            if (!allVariantValue.includes("-- Select --")) {
              allVariantName.forEach(
                (name, index) =>
                  (variantParam += `&${encodeURIComponent(name)}=${encodeURIComponent(allVariantValue[index])}`)
              );
            }
          }
    
          const foxyBtn = document.createElement("a");
          foxyBtn.innerText = "Add to Cart";
          foxyBtn.className = addToCartBtn.className;
          foxyBtn.id = "addtocart-btn";
    
          const cartUrl = `https://${foxySubdomain}.foxycart.com/cart?name=${encodeURIComponent(name)}&price=${price}&quantity=${quantity}&image=${encodeURIComponent(image)}`;
    
          if (variantSelect.length === 0) {
            foxyBtn.href = cartUrl;
          } else if (variantSelect.length > 0 && !!variantParam) {
            foxyBtn.href = cartUrl + variantParam;
          }
    
          addToCartBtn.parentElement.appendChild(foxyBtn);
          addToCartBtn.remove();
        }
    
        if (parent.window.location.pathname === "/shop/ols/cart") {
          parent.window.location.href = `https://${foxySubdomain}.foxycart.com/cart?cart=view`;
        }
      }, 500);
    </script>
  5. In line 3 of the code above, change "YOUR_STORE" to your Foxy store subdomain. For example, if your store domain is my-store.foxycart.com, the value should be "my-store"
  6. In the Force Height setting, enter 1 for the pixels value to minimize the size of this section
  7. Publish the site, and test by adding different products to cart

In This Article

Related Articles

Login or Browser Verification Issues
Standard Template Screenshots
Set up a customer portal

Need help?

Can't find the answers you're looking for? Our team is here to help. Please click below to contact us.

Contact Us