{"id":18226794,"url":"https://github.com/ymcatwincities/commerce_cart_api","last_synced_at":"2026-04-30T10:03:50.436Z","repository":{"id":57032379,"uuid":"305665204","full_name":"ymcatwincities/commerce_cart_api","owner":"ymcatwincities","description":"Fork of commerce_cart_api for D9 composer support","archived":false,"fork":false,"pushed_at":"2023-08-11T09:41:32.000Z","size":218,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"8.x-1.x","last_synced_at":"2025-11-28T01:46:29.062Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ymcatwincities.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-20T10:02:02.000Z","updated_at":"2023-08-11T09:41:39.000Z","dependencies_parsed_at":"2022-08-23T20:50:22.406Z","dependency_job_id":null,"html_url":"https://github.com/ymcatwincities/commerce_cart_api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ymcatwincities/commerce_cart_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymcatwincities%2Fcommerce_cart_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymcatwincities%2Fcommerce_cart_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymcatwincities%2Fcommerce_cart_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymcatwincities%2Fcommerce_cart_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ymcatwincities","download_url":"https://codeload.github.com/ymcatwincities/commerce_cart_api/tar.gz/refs/heads/8.x-1.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymcatwincities%2Fcommerce_cart_api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32460781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-04T05:03:35.442Z","updated_at":"2026-04-30T10:03:50.401Z","avatar_url":"https://github.com/ymcatwincities.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Commerce Cart API\n\nSandbox to provide a RESTful interface to interact with carts in Drupal Commerce via a lightweight public API.\n\n## How to test it out\n\n* Clone down this repository into your Drupal Commerce TESTING PROJECT\n* Add `$settings['extension_discovery_scan_tests'] = TRUE;` to your settings.php\n* Enable `commerce_cart_api`\n* Enabled `commerce_cart_reactjs`\n* Remove default cart block with `commerce_cart_reactjs`\n* Cart form automatically swapped.\n\n## GET (carts)\n\n```bash\ncurl 'http://localhost:32775/cart?_format=json'\n```\n\nExample JSON response for above.\n\n```json\n[\n  {\n    \"order_id\": 2,\n    \"uuid\": \"be9cb309-2c77-4f85-9444-013c91ab9318\",\n    \"order_number\": null,\n    \"store_id\": 1,\n    \"total_price\": {\n      \"number\": \"403.97\",\n      \"currency_code\": \"USD\"\n    },\n    \"order_items\": [\n      {\n        \"order_item_id\": 9,\n        \"uuid\": \"dcaa6901-f799-4505-af4c-9d1db9a85bbb\",\n        \"type\": \"physical_product_variation\",\n        \"purchased_entity\": 4,\n        \"title\": \"Drupal Commerce Hoodie - Green, Small\",\n        \"quantity\": \"2.00\",\n        \"unit_price\": {\n          \"number\": \"52.00\",\n          \"currency_code\": \"USD\"\n        },\n        \"total_price\": {\n          \"number\": \"104.00\",\n          \"currency_code\": \"USD\"\n        }\n      },\n      {\n        \"order_item_id\": 21,\n        \"uuid\": \"3bb80d13-ec7d-4e69-af33-a2f014c5e284\",\n        \"type\": \"physical_product_variation\",\n        \"purchased_entity\": 15,\n        \"title\": \"Pronto600 Instant Camera\",\n        \"quantity\": \"3.00\",\n        \"unit_price\": {\n          \"number\": \"99.99\",\n          \"currency_code\": \"USD\"\n        },\n        \"total_price\": {\n          \"number\": \"299.97\",\n          \"currency_code\": \"USD\"\n        }\n      }\n    ]\n  }\n]\n\n```\n\n## POST\n\nExample to add items to cart. Creates or carts or adds to existing.\nOptional: Add the \"combine\" property to the payload (TRUE by default). FALSE will create another order item, while TRUE will increment an existing item.\n\n```bash\ncurl -X POST \\\n  'http://localhost:32775/cart/add?_format=json' \\\n  -H 'Content-Type: application/json' \\\n  -d '[{ \"purchased_entity_type\": \"commerce_product_variation\", \"purchased_entity_id\": \"6\", \"quantity\": \"1\", \"combine\": true }]'\n```\n\nResponse\n\n```json\n[\n    {\n        \"order_id\": 7,\n        \"uuid\": \"d0e68a71-780d-422e-b951-5ffc980bd296\",\n        \"order_number\": null,\n        \"store_id\": 1,\n        \"total_price\": {\n            \"number\": \"174.00\",\n            \"currency_code\": \"USD\"\n        },\n        \"order_items\": [\n            {\n                \"order_item_id\": 26,\n                \"uuid\": \"ec920271-51f7-4869-8e8f-46bdd733ba58\",\n                \"type\": \"physical_product_variation\",\n                \"purchased_entity\": 21,\n                \"title\": \"24\\\" x 36\\\" Hot Air Balloons\",\n                \"quantity\": \"2.00\",\n                \"unit_price\": {\n                    \"number\": \"35.00\",\n                    \"currency_code\": \"USD\"\n                },\n                \"total_price\": {\n                    \"number\": \"70.00\",\n                    \"currency_code\": \"USD\"\n                }\n            },\n            {\n                \"order_item_id\": 27,\n                \"uuid\": \"ac0a2890-38ab-4332-8425-8df7f1458552\",\n                \"type\": \"physical_product_variation\",\n                \"purchased_entity\": 6,\n                \"title\": \"Drupal Commerce Hoodie - Green, Large\",\n                \"quantity\": \"2.00\",\n                \"unit_price\": {\n                    \"number\": \"52.00\",\n                    \"currency_code\": \"USD\"\n                },\n                \"total_price\": {\n                    \"number\": \"104.00\",\n                    \"currency_code\": \"USD\"\n                }\n            }\n        ]\n    }\n]\n```\n\n\n## PATCH\n\nA JSON object of order item IDs whose values are objects that define the item's new quantity.\n\n```\n{\n  3: {\"quantity\": 1},\n  9: {\"quantity\": 2},\n}\n```\n\n\n```bash\ncurl 'http://localhost:32775/cart/1/items?_format=json' -X PATCH \\\n    -H 'Content-Type: application/json' \\\n    --data-binary '{\"2\":{\"quantity\":\"1\"},\"3\":{\"quantity\":\"1.00\"}}'\n```\n\nResponse\n\n```json\n{\n  \"order_id\": 2,\n  \"uuid\": \"be9cb309-2c77-4f85-9444-013c91ab9318\",\n  \"order_number\": null,\n  \"store_id\": 1,\n  \"total_price\": {\n    \"number\": \"303.98\",\n    \"currency_code\": \"USD\"\n  },\n  \"order_items\": [\n    {\n      \"order_item_id\": 9,\n      \"uuid\": \"dcaa6901-f799-4505-af4c-9d1db9a85bbb\",\n      \"type\": \"physical_product_variation\",\n      \"purchased_entity\": 4,\n      \"title\": \"Drupal Commerce Hoodie - Green, Small\",\n      \"quantity\": \"2.00\",\n      \"unit_price\": {\n        \"number\": \"52.00\",\n        \"currency_code\": \"USD\"\n      },\n      \"total_price\": {\n        \"number\": \"104.00\",\n        \"currency_code\": \"USD\"\n      }\n    },\n    {\n      \"order_item_id\": 21,\n      \"uuid\": \"3bb80d13-ec7d-4e69-af33-a2f014c5e284\",\n      \"type\": \"physical_product_variation\",\n      \"purchased_entity\": 15,\n      \"title\": \"Pronto600 Instant Camera\",\n      \"quantity\": \"2.00\",\n      \"unit_price\": {\n        \"number\": \"99.99\",\n        \"currency_code\": \"USD\"\n      },\n      \"total_price\": {\n        \"number\": \"199.98\",\n        \"currency_code\": \"USD\"\n      }\n    }\n  ]\n}\n```\n\n## DELETE\n\nRemoves an order item from the cart.\n\n```bash\ncurl 'http://localhost:32775/cart/2/items/9?_format=json' -X DELETE\n```\n\nResponse\n\nNo body, just HTTP code.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymcatwincities%2Fcommerce_cart_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fymcatwincities%2Fcommerce_cart_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymcatwincities%2Fcommerce_cart_api/lists"}