使用Shopify产品页面URL参数来控制页面加载上的默认大小(此 /可能类似吗?)
是否感兴趣,如果可能的话?
即使有人知道一个描述此过程的支持页面,那真是太神奇了!
一直在搜索一堆,但没有运气。
这里的目标是我们有类别(集合)页面,可能是“ King大小的床单”,但是页面上的产品包含多种尺寸变体。
我们想使用一个URL参数(或真正完成同一件事的任何东西),以便使用“集合”页面中的这些链接>>产品页面,以便从“大尺寸床单”页面点击时,产品将在“ King”大小上加载。
任何帮助都会很棒!
Interested in if this is possible?
Even if someone knows of a support page where it describes this process, that would be amazing!
Have been searching a bunch, but no luck.
The goal here is that we have category (collection) pages that might be something like “king sized sheets” – but the products featured on the page contain multiple size variants.
We would like to use a URL parameter (or anything really that accomplishes the same thing) in order to use those links from the collection page >> product page so that the products will load on “king” size when clicked from the “king sized sheets” page.
Any help would be amazing!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在这些收集页面上的各个大小查询各个大小的变体,以便您可以链接到它们。这是您的收集模板目前可能的样子:
product-item
sippet链接到https://myshop.com/products/mymy -product?variant = 123
默认情况下将选择具有ID“ 123”的产品变体。
现在的“挑战”是更改您的
product-perem
的链接,以便它链接到特定变体。一个基本示例看起来像这样:将
option1
更改为您的大小选项的任何位置(还将king-size
更改为要过滤的值的确切名称)。然后确保用
product.url
链接variant.url
。You'd need to query the variant with the respective size on those collection pages so you can link to them. This is what your collection template probably looks like at the moment:
The
product-item
snippet links toproduct.url
. Which variant is selected on page load is then determined by your product template. In most cases this is done viaproduct.selected_or_first_available_variant
. The selected variant is based on the URL parametervariant
. So, for example, if you navigate tohttps://myshop.com/products/my-product?variant=123
the product variant with the ID "123" will be selected by default.
The "challenge" now is to change the link of your
product-item
so it links to a specific variant. An basic example would look like this:Change
option1
to whatever position your size option has (also changeking-size
to the exact name of the value you want to filter).Then make sure to replace the
product.url
link withvariant.url
.