gpt4 book ai didi

wordpress - 按属性过滤的 WooCommerce URL

转载 作者:行者123 更新时间:2023-12-04 15:52:52 25 4
gpt4 key购买 nike

我正在尝试根据属性找出在我的商店页面上显示产品所需的 URL。该属性称为“Mantel Type”(slug ma​​ntel-type),术语为“Mantel With Overmantel”(slug ma​​ntel -with-overmantel).该术语的 ID 为 106。我尝试了以下 URL,但显示了所有产品,而不是预期的 22 个,或者我收到 404 错误。

mysite.com/shop/?attribute_mantel-type=Mantel+With+Overmantel

mysite.com/shop/?attribute_mantel-type=mantel-with-overmantel

mysite.com/shop/?taxonomy=pa_mantel-type?&tag_ID=106

mysite.com/shop/?filter_mantel-type=106

mysite.com/shop/?filter_mantel-type=Mantel+With+Overmantel

mysite.com/shop/?filter_mantel-type=mantel-with-overmantel

mysite.com/shop/?pa_mantel-type=Mantel+With+Overmantel(404 错误)

mysite.com/shop/?pa_mantel-type=106(404 错误)

我已确保在 Mantel Type 属性编辑器中选中了启用存档复选框。

我在产品类别方面取得了成功,但在属性方面却没有。此产品类别链接有效,例如:

mysite.com/shop/?product_cat=french

如何在 URL 中也包含属性?感谢您的宝贵时间。

最佳答案

Woocommerce 属性只是 Wordpress 分类法。

https://example.com/mantel-type/mantel-with-overmantel/会得到你想要的。我想有一些方法可以得到 https://tart.dolcedev.com/shop/mantel-type/mantel-with-overmantel/去你想要的,但我对你的 wp 设置了解不够,无法帮助你。

您还可以使用 get_term_link 动态生成这些 url。 https://developer.wordpress.org/reference/functions/get_term_link/

带有“?”的网址全部进入“商店”页面。 url 中的任何内容都以 ?只是一个查询字符串。

关于wordpress - 按属性过滤的 WooCommerce URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53126748/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com