设想
我们有一个安装了 的 rails 应用程序Spreecommerce 作为 Rails::Engine 并托管在 dashboard.domainname.com
并可通过 dashboard.domainname.com/store
获得然后我们在 www.domainname.com
实现了前端的 wordpress。 .
要求
我们现在需要在 中显示结帐金额和数量wordpress 应用程序的一面。单击此按钮将导致 check out rails 应用程序本身,因此不会出现问题。
*注意:请注意,即使没有登录,用户也可以将产品添加到购物车。
最佳答案
使用安全/加密的 cookie 与 wordpress 和 rails 共享购物车详细信息,
How do we achieve this?
使用cookies,
Storing an encrypted cookie with Rails ,
http://api.rubyonrails.org/classes/ActionDispatch/Session/CookieStore.html
Is it accessible through cookies?
是的,引用上面的答案。
If so how can it be shared throughout different sub-domains?
cookies.signed[:secret] # 返回“foo bar”
教程,
Here .
关于ruby-on-rails - 在子域 Rails 中实现 Spree Cart,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35364043/