创建GraphiQL请求以通过referralCode或utmParameters过滤订单

问题描述 投票:0回答:1

我正在创建一个 Shopify 应用程序,我将从后端查询 Shopify 网站上的订单,以检测我的网站引用的订单。

我在引导用户访问的初始页面上使用 utm 参数,并且它们一直正确传递到 order_completed。我可以在订单的 customerJourney 中获取 utm 参数。

挑战在于我只想获取与我相关的订单,因为查看商店的所有订单会导致数据泄露。有没有办法在 GraphiQL 过滤器中实现这一点?如果没有,您以其他方式实现这一目标的指导是什么?

类似于下面的内容,但查询似乎没有正确过滤。 utm 的替代方案,我可以使用referralCode,但过滤问题仍然存在......

{
  orders(
    first: 100
    query: "created_at:>='2024-02-21' AND customerJourney.moments.utmParameters.source:test_keyword"
    reverse: true
  ) {
    edges {
      node {
        name
        id
        createdAt
        channelInformation {
          id
        }
        currentTotalPriceSet {
          presentmentMoney {
            amount
          }
        }
        customer {
          id
        }
        customerJourneySummary {
          firstVisit {
            landingPage
          }
          lastVisit {
            landingPage
          }
        }
        customerJourney {
          moments {
            ... on CustomerVisit {
              utmParameters {
                source
                campaign
                content
                medium
                term
              }
            }
          }
        }
      }
    }
  }
}
shopify shopify-app shopify-api shopify-template shopify-storefront-api
1个回答
0
投票

这是不可能的,目前这些是您在查询订单时可以使用的唯一过滤器(从这里https://shopify.dev/docs/api/admin-graphql/2024-01/queries/orders) :

  • 购物车令牌
  • 频道
  • 频道_id
  • chargeback_status
  • 结帐_令牌
  • 确认号
  • 创建于
  • credit_card_last4
  • 客户 ID
  • 送货方式
  • 折扣代码
  • 电子邮件
  • 财务状况
  • 欺诈保护级别
  • fulfillment_location_id
  • 履行状态
  • 网关
  • 位置_id
  • 名字
  • 付款_id
  • 付款提供商_id
  • po_number
  • 已处理_at
  • 参考位置_id
  • 返回状态
  • 风险级别
  • 销售渠道
  • sku
  • 源标识符
  • 来源名称
  • 状态
  • 标签
  • 标记_不
  • 测试
  • 更新于

如果这些字段都无法帮助您,我建议您使用 Flow 标记订单(您应该能够在那里使用买家旅程),然后搜索该标签。

© www.soinside.com 2019 - 2024. All rights reserved.