Cookies 如何在shopify liquid文件中设置和使用会话变量?

Cookies 如何在shopify liquid文件中设置和使用会话变量?,cookies,session-variables,shopify,liquid,Cookies,Session Variables,Shopify,Liquid,我需要在shopify中设置session变量,但没有找到相关文档 当用户登录shopify应用程序时,它会创建会话(或cookie),然后如何手动完成。 我的要求是将特定页面上的一些输入数据用于会话变量可以实现的另一个页面 请在Shopify中回复是否可能。如果可能,请尝试粘贴一些代码。如果没有,那么我如何在Shopify中做到这一点 谢谢。我不知道你是否知道,但下面是我如何使用javascript跟踪推荐登录页的: 我添加了一个带有代码()的登录页,该代码在存储cookie后重定向到主商店页

我需要在shopify中设置session变量,但没有找到相关文档

当用户登录shopify应用程序时,它会创建会话(或cookie),然后如何手动完成。 我的要求是将特定页面上的一些输入数据用于会话变量可以实现的另一个页面

请在Shopify中回复是否可能。如果可能,请尝试粘贴一些代码。如果没有,那么我如何在Shopify中做到这一点


谢谢。

我不知道你是否知道,但下面是我如何使用javascript跟踪推荐登录页的:

我添加了一个带有代码()的登录页,该代码在存储cookie后重定向到主商店页面


函数getParameterByName(名称、url){
如果(!url){
url=window.location.href;
}
name=name.replace(/[\[\]]/g,\\$&);
var regex=new RegExp(“[?&]”+name+”(=([^&#]*)和|#|$),
结果=regex.exec(url);
如果(!results)返回null;
如果(!results[2])返回“”;
返回组件(结果[2]。替换(/\+/g,”);
}
函数setCookie(cname、cvalue、exdays){
var d=新日期();
d、 设置时间(d.getTime()+(exdays*24*60*60*1000));
var expires=“expires=“+d.toutString();
document.cookie=cname+“=”+cvalue+”;“+expires+”;path=/”;
}
setCookie('reference',getParameterByName('ref',null,1));
window.location=http://www.myshopifysite.com';

函数getParameterByName(名称、url){
如果(!url){
url=window.location.href;
}
name=name.replace(/[\[\]]/g,\\$&);
var regex=new RegExp(“[?&]”+name+”(=([^&#]*)和|#|$),
结果=regex.exec(url);
如果(!results)返回null;
如果(!results[2])返回“”;
返回组件(结果[2]。替换(/\+/g,”);
}
函数setCookie(cname、cvalue、exdays){
var d=新日期();
d、 设置时间(d.getTime()+(exdays*24*60*60*1000));
var expires=“expires=“+d.toutString();
document.cookie=cname+“=”+cvalue+”;“+expires+”;path=/”;
}
setCookie('reference',getParameterByName('ref',null,1));
window.location=http://www.myshopifysite.com';

您无法访问shopify中的会话。您必须使用某种javascript解决方案。