admin管理员组

文章数量:1434380

I have a standard WordPress WooCommerce site, and I recently integrated a three.js landing page with links to the WooCommerce site. To display the animated landing page, I added the .js file and an index.html file to the public_html directory of my site.

However, when I do this, the AJAX "add to cart" functionality and the mini side cart stop working; all other functionality remains intact. The index.html file doesn’t contain any WooCommerce-related code (see below). To debug, I even tested with a completely blank index.html file, and the issue still occurs.

Does anyone know why adding an index.html file would interfere with WooCommerce’s AJAX functionality? Alternatively, is there a better way to incorporate the three.js landing page without using an index.html file?

Index.html file content:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" href="/assets/EveryRep-logo-black-DcJJJvSs.svg" type="image/svg+xml">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>EveryRep - Premium Sustainable Athletic Apparel for Fitness Enthusiasts</title>
    <meta name="description" content="EveryRep - Premium Sustainable Athletic Apparel for Fitness Enthusiasts" />
    <meta name="keywords" content="fitness, athletic apparel, sustainable clothing, ecofriendly, workout clothes, gym wear, yoga pants, running shoes, mens clothing, womens clothing, activewear, outdoor gear, hiking boots">
    <meta name="author" content="EveryRep">
    <meta name="robots" content="index,follow">
    <meta name="google-site-verification" content="Google verification token">
    <meta property="og:title" content="EveryRep - Premium Sustainable Athletic Apparel for Fitness Enthusiasts">
    <meta property="og:description" content="EveryRep - Premium Sustainable Athletic Apparel for Fitness Enthusiasts">
    <meta property="og:image" content="/src/assets/EveryRep-logo-black.svg">
    <meta property="og:url" content=";>
    <meta property="og:type" content="website">
    <script type="module" crossorigin src="/assets/index-DsGnWYTW.js"></script>
    <link rel="stylesheet" crossorigin href="/assets/index-BxLv6ccw.css">
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

I've also tried:

  1. Adding the three.js to a staging site with links to my regular site. Everything works in this scenario but I cannot use this solution as I need everything to share the same base URL

  2. Using an empty index.html file. Even an empty index.html file in the root directory of my live site breaks the add to cart and side mini cart.

本文标签: reactjsIncorporating threejs landing page in Wordpress woocommerce siteStack Overflow