最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

reactjs - Incorporating three.js landing page in Wordpress woocommerce site - Stack Overflow

matteradmin7PV0评论

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.

Post a comment

comment list (0)

  1. No comments so far