duncanmcclean / simple-commerce

A simple, yet powerful e-commerce addon for Statamic.
https://statamic.com/simple-commerce
Other
143 stars 34 forks source link

[6.x] Prevent passing the cart to the view #1013

Closed duncanmcclean closed 5 months ago

duncanmcclean commented 5 months ago

This pull request prevents the cart variable from being passed from SC's controllers into the view.

Normally, when using entries, there's no issue with this. However, when using database orders and Runway v6, some of the raw augmented data contains query builders, which contain PDO objects which can't be serialized, leading to an error (#1003).

The easiest way to fix this is to just prevent the cart variable from being passed into the view. I can't find anywhere we're actually using the passed down cart variable in the docs or the starter kit and can't think of a case where you'd want it over using the {{ sc:cart }} tag.

We are still returning the cart data from the action controllers though but just for JSON responses where it doesn't seem to be an issue (probably because they get serialized differently).

Fixes #1003.

github-actions[bot] commented 5 months ago

Released as part of v6.0.6.