Skip to content

Added the Cart Resource #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 15, 2021
Merged

Added the Cart Resource #204

merged 1 commit into from
Jun 15, 2021

Conversation

whobutsb
Copy link
Contributor

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:

{
  "token": "1d19a32178501c44ef2223d73c54d16d",
  "note": null,
  "attributes": {},
  "total_price": 0,
  "total_weight": 0,
  "item_count": 0,
  "items": [],
  "requires_shipping": false,
  "currency": "CAD"
}

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!

The Cart resource is read only, where you would provide the cart_token to retrieve the cart object.
Example: `$shopify->Cart('ea4a55031cbbcd5621918d3a893869b0')->get()`

You can retrieve the cart token on your website by using the following javascript snippet `var cart_token = document.cookie.match('(^|; )cart=([^;]*)');`
@tareqtms tareqtms merged commit 27ccacf into phpclassic:master Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants