Getting Spree Cart implemented in sub-domain Rails
Asked Answered
B

1

8

Scenario

We have a rails application mounted with Spreecommerce as Rails::Engine and hosted at dashboard.domainname.com and available through dashboard.domainname.com/store then we have the wordpress for front-end implemented at www.domainname.com.

Requirement

We now need to show the checkout amount and quantity in the wordpress side of the application. Clicking on this would lead to checkout of the rails application itself so won't be problem for there on.

  • How do we achieve this?
  • Is it accessible through cookies?
  • If so how can it be shared throughout different sub-domains?

Spreecommerce checkout requirement

*Note: Please consider that a user can add products to cart even without signing in.

Basil answered 12/2, 2016 at 13:38 Comment(1)
You can save in the cookie but that's not secure. Save it using encrypted cookies or signed cookie so that the user won't tamper. Nevertheless, you can read this:- excid3.com/blog/…Interoceptor
M
2

Use secure/encrypted cookies to share cart details with wordpress and rails,

How do we achieve this?

Use cookies, Storing an encrypted cookie with Rails, http://api.rubyonrails.org/classes/ActionDispatch/Session/CookieStore.html

Is it accessible through cookies?

Yes, refer above answer.

If so how can it be shared throughout different sub-domains?

cookies.signed[:secret] # returns "foo bar"

Tutorial, Here.

Mitosis answered 18/2, 2016 at 6:11 Comment(2)
Yes, the answer is good but just thought not specific enough for the bounty! Like it doesn't mention how to access spree cart information or maybe my question wasn't clear enough?Basil
I thought this site provide solutions, not spoon feeding.Mitosis

© 2022 - 2024 — McMap. All rights reserved.