有什么方法可以根据签出的产品标题中的关键字将客户重定向到 link?

Any way to redirect a customer to a link based on a keyword in a checked out product title?

我需要能够将购买特定产品的客户重定向到表单以获取更详细的数据 collection。在编程方面不太有经验,但我目前在我的附加脚本部分中有这个。

我已经搜索了所有这些文档,但不知道如何实现它。 https://help.shopify.com/en/themes/liquid/objects/checkout

目前关键字自动结账有这个:

  {% if line.product.handle.includes('**autocheckout**') %}
     <script> window.location ="https://docs.google.com"; </script>
{% break %}
  {% endif %}
{% endfor %}

我希望这会重定向,但它不起作用。

你很接近,只需要指定.href,

您目前有

<script> window.location = "https://docs.google.com"; </script>

只要让它工作,它模拟鼠标点击

<script> window.location.href = "https://docs.google.com"; </script>

此外,您也可以尝试这个,它模拟 HTTP 重定向

<script> window.location.replace = "https://docs.google.com"; </script>