条件运算符参考
为徽章创建定位规则时可用的所有条件字段和运算符。
定位规则是由三部分组成的一行:字段、运算符和值。可用的运算符取决于您选择的字段:文本字段提供 contains 和 starts with,数值字段提供 is greater than,依此类推。
您可以在徽章编辑器的 Products 标签页中选择 Products matching conditions 后创建这些规则行。
字段下拉菜单分为多个分组。
| 字段 | 匹配内容 |
|---|---|
| Product title | 产品名称。 |
| Product type | Shopify 的产品类型字段。 |
| Product vendor | 供应商名称。 |
| Product price | 当前价格。 |
| Product compare price | 原价。 |
| Product sale price | 折后价格。 |
| Product option | 产品选项,例如尺寸或颜色。 |
| Product tag | 产品上的任意标签。 |
| Product weight | 产品重量。 |
| Product created | 产品创建至今的时间,以天为单位。 |
| Product published | 产品发布至今的时间,以天为单位。 |
| Product inventory | 库存数量和库存状态。 |
| Product metafield | 产品元字段的值。 |
| 字段 | 匹配内容 |
|---|---|
| Product variants | 产品是否有多属性。 |
| Variant inventory | 各个多属性的库存数量。 |
| Variant metafield | 多属性元字段的值。 |
产品系列条件
Section titled “产品系列条件”| 字段 | 匹配内容 |
|---|---|
| Collections | 产品所属的产品系列。 |
| 字段 | 匹配内容 |
|---|---|
| Sami discount | 应用 Discounts 页面上某个折扣所涵盖的产品。 |
Sami discount 只有一个运算符 is equal to,值为某一个折扣。使用它可以仅在该折扣生效期间显示徽章,并通过 {sami_discount_*} 变量将折扣自身的数值填入徽章文字。请参阅动态变量参考。
产品评价条件
Section titled “产品评价条件”| 字段 | 匹配内容 |
|---|---|
| Product review app | 其评价应用中的评分或评价数量达到您所设阈值的产品。 |
Product review app 只有一个运算符 is equal to,值为某一个评价应用:Judge.me、Loox、Junip、CWILL(Trustoo)、LAI Product Reviews 或 AG Product Reviews。决定是否匹配的比较条件在其专属字段中设置,详见下文。
一个徽章只能包含一个评价应用条件;该条件使用后,其他行中的此选项会变灰。请参阅显示来自评价应用的徽章。
按字段类型划分的运算符
Section titled “按字段类型划分的运算符”Product title、type、vendor、option、tag。
| 运算符 | 含义 |
|---|---|
| is equal to | 与您输入的值完全一致。 |
| is not equal to | 与该值不一致。 |
| starts with | 以您输入的文字开头。 |
| ends with | 以您输入的文字结尾。 |
| contains | 在任意位置包含该文字。 |
| does not contain | 不包含该文字。 |
Product price、compare price、sale price、weight。
| 运算符 | 含义 |
|---|---|
| is equal to | 与您输入的数字完全相等。 |
| is not equal to | 除您输入的数字之外的任何数字。 |
| is greater than | 大于您输入的数字。 |
| is less than | 小于您输入的数字。 |
| 运算符 | 含义 |
|---|---|
| in stock | 产品当前有库存。 |
| out of stock | 库存已降为零。 |
| continue selling when out of stock | 产品设置为库存为零后仍继续销售。 |
| stock availability is greater than | 库存高于您输入的阈值。 |
| stock availability is less than | 库存低于您输入的阈值。 |
前三个运算符不需要填写值,运算符本身就是条件。
Product created、Product published。值是从今天向前推算的 day(s) 天数,而不是日历日期。
| 运算符 | 含义 |
|---|---|
| is less than | 创建或发布不到 N 天,可用于“新品”徽章。 |
| is greater than | 创建或发布超过 N 天。 |
| is in range | 介于两个天数之间。 |
Product variants
Section titled “Product variants”| 运算符 | 含义 |
|---|---|
| is equal to / is not equal to | 与指定的多属性数量比较。 |
| products with variants | 产品有多个多属性。 |
| product has no variants | 产品只有默认的单一多属性。 |
产品评价指标
Section titled “产品评价指标”选择评价应用后,Product review app 会在条件列表下方显示其专属字段。
| 字段 | 选项 |
|---|---|
| Review condition | Number of reviews:产品的评价数量。Product rating:产品的平均星级评分。 |
| Operator | is equal to、is greater than、is less than。 |
| Enter value | Product rating 取值为 0 到 5,步长为 0.1;Number of reviews 取值为整数。此项必填,留空将无法保存。 |
使用 Add conditions 添加所需数量的行,然后通过上方的 Products must match 单选项决定这些条件如何组合:
all conditions (AND)
Section titled “all conditions (AND)”每一行都必须为真。会缩小匹配范围。
**示例:**Product type is equal to “T-Shirt” 并且 Product vendor is equal to “Nike” → 仅匹配 Nike 的 T 恤。
any condition (OR)
Section titled “any condition (OR)”满足任意一行即可。会扩大匹配范围。
**示例:**Product tag is equal to “new-arrival” 或者 Product tag is equal to “featured” → 带有任一标签的产品。
- 按属性定位产品:逐步设置属性条件。
- 定位指定产品:改为手动挑选单个产品。
- 显示来自评价应用的徽章:评价条件及其变量的完整说明。
- 套餐对比:查看您的套餐包含哪些条件。