Added the Cart Resource #204
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
Cart
resource is read only, where you can provide the cart_token to retrieve the Shopify cart object.Example:
$shopify->Cart('1d19a32178501c44ef2223d73c54d16d')->get()
Example Response:
You can retrieve the cart token on your website by using the following javascript snippet:
var cart_token = (document.cookie.match('(^|; )cart=([^;]*)') || 0)[2];
I'm sorry I didn't provide any tests because this is really a shop specific resource request. I did test the cart resource using my own shop and credentials and it worked just fine.
I'm not completely versed in the library and might be missing some class properties that would be needed to prevent the user from using the update or post methods. Please let me know if there are any additional changes I need to have this merged in to project.
Thank you!