0

我似乎找不到任何关于是否可以使用 Liquid 或 Shopify API 将标签分配给登录客户的文档。

我知道我可以手动将标签添加到现有客户,但我真的希望有一种更有效的方法来解决它 - 例如创建一个按钮/链接,将特定客户标签分配给已登录客户的客户资料他们点击它 - 可以这么说,让他们标记自己。

我知道{% assign %}Liquid 中有这个功能,但它似乎无法影响诸如{{ customer.tags }}.

4

1 回答 1

0

似乎很容易。如果客户选择标记自己,请将标签发送到您的应用程序,您可以在其中使用 API 更新客户标签。您可以为此使用 Ajax。检查控制台...我很快在客户身上设置了一些标签,假设电话到达时带有标签,一切正常。

c = Customer.first
=> #<ShopifyAPI::Customer:0x000001012dafa8 @attributes={"accepts_marketing"=>true, "created_at"=>"2012-06-08T22:15:47-04:00", "email"=>"ding@dong.com", "first_name"=>"d", "id"=>92898480, "last_name"=>"dong", "last_order_id"=>nil, "note"=>nil, "orders_count"=>0, "state"=>"disabled", "total_spent"=>"0.00", "updated_at"=>"2012-06-08T22:21:22-04:00", "tags"=>"", "last_order_name"=>nil, "addresses"=>[#<ShopifyAPI::Address:0x000001012d77b8 @attributes={"address1"=>"1330 14th Street", "address2"=>"", "city"=>"Santa Monica", "company"=>"dong incorporated", "country"=>"Canada", "first_name"=>"d", "id"=>128540200, "last_name"=>"dong", "phone"=>"3103950840", "province"=>"", "zip"=>"90404", "name"=>"d dong", "province_code"=>nil, "country_code"=>"CA", "default"=>true}, prefix_options{}, persistedfalse]}, prefix_options{}, persistedtrue

>> c.tags = "Holy Roller, Vagrant Snafu"
=> "Holy Roller, Vagrant Snafu"
>> c.save!
=> true
>> c = Customer.first
=> #<ShopifyAPI::Customer:0x00000101339968 @attributes={"accepts_marketing"=>true, "created_at"=>"2012-06-08T22:15:47-04:00", "email"=>"ding@dong.com", "first_name"=>"d", "id"=>92898480, "last_name"=>"dong", "last_order_id"=>nil, "note"=>nil, "orders_count"=>0, "state"=>"disabled", "total_spent"=>"0.00", "updated_at"=>"2012-09-13T14:23:39-04:00", "tags"=>"Holy Roller, Vagrant Snafu", "last_order_name"=>nil, "addresses"=>[#<ShopifyAPI::Address:0x000001013372d0 @attributes={"address1"=>"1330 14th Street", "address2"=>"", "city"=>"Santa Monica", "company"=>"dong incorporated", "country"=>"Canada", "first_name"=>"d", "id"=>128540200, "last_name"=>"dong", "phone"=>"3103950840", "province"=>"", "zip"=>"90404", "name"=>"d dong", "province_code"=>nil, "country_code"=>"CA", "default"=>true}, prefix_options{}, persistedfalse]}, prefix_options{}, persistedtrue
>> c.tags
=> "Holy Roller, Vagrant Snafu"

因此,您似乎可以很快设置一些东西来让客户标记自己。

于 2012-09-13T18:27:58.543 回答