You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Shopify技术求助:如何添加跳转至商品页的新按钮?

解决方案

你当前的Featured Collection区块代码只是调用了一个名为section--featured-collection的代码片段(snippet),实际的商品卡片渲染逻辑在snippets/section--featured-collection.liquid文件中,需要修改这个文件来添加按钮:

  1. 找到目标snippet文件
    在Shopify主题编辑器中,打开snippets文件夹,找到section--featured-collection.liquid文件。

  2. 定位商品价格区域
    在该文件中找到遍历商品的循环(通常是{% for product in collection.products %}开头的代码块),然后找到显示商品价格的部分,可能是类似以下的代码:

    <div class="product-price">
      {{ product.price | money }}
    </div>
    

    或者是调用价格组件的代码:

    {% render 'price', product: product %}
    
  3. 添加"Learn More"按钮
    在价格代码的下方插入以下按钮代码:

    <a href="{{ product.url }}" class="button">Learn More</a>
    
    • {{ product.url }}会自动生成对应商品的详情页链接
    • class="button"可以替换成你主题中已有的按钮样式类(比如btn、product-card-button等),确保按钮样式和主题统一
  4. 保存并预览
    修改完成后保存文件,回到店铺前台预览Featured Collection区块,就能看到价格下方的"Learn More"按钮,点击即可跳转到对应商品页。

如果你的主题中价格是通过单独的snippet(比如price.liquid)渲染的,也可以直接修改那个snippet文件,在价格输出后添加按钮代码。

内容的提问来源于stack exchange,提问作者Mikey

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 08:30:47