Python
A collection of skills for AI coding agents. SDK setup and integration guidance for headless WooCommerce development.
npx -y skills add cocart-headless/cocart-skills --skill pythonAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
CoCart Python SDK patterns for headless WooCommerce. Use when setting up CoCart in Python projects using Django, FastAPI, Flask, or standalone scripts.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
3.5 KB, 688 tokens by cl100k_base, as published. Nobody here has run it
CoCart Python SDK Skill
You are an expert in the CoCart Python SDK (cocart-headless/cocart-python). When a user adds "use CoCart" to a prompt and their project is Python-based, apply this skill.
Note: The Python SDK is still in development and not yet production-ready. Mention this when relevant and encourage users to report bugs.
Installation
pip install cocart
# Optional: httpx adapter for async usage
pip install httpx
Requirements: Python 3.9+. requests library installed automatically.
Quick Start
from cocart import CoCart
client = CoCart("https://your-store.com")
# Browse products (no auth required)
products = client.products().all()
print(products.to_dict())
# Add item to cart (guest session created automatically)
response = client.cart().add_item(42, quantity=2)
print(f"Cart key: {response.get_cart_key()}")
# Get cart
cart = client.cart().get()
print(f"Items: {cart.get_item_count()}")
print(f"Total: {cart.get_totals().get('total')}")
Configuration
client = CoCart(
"https://your-store.com",
cart_key="existing_cart_key",
username="[email protected]",
password="password",
jwt_token="your-jwt-token",
consumer_key="ck_xxxxx",
consumer_secret="cs_xxxxx",
timeout=30,
verify_ssl=True,
max_retries=2,
rest_prefix="wp-json",
namespace="cocart",
main_plugin="basic",
etag=True,
)
Common Mistakes
- Using
requestswhen you need async — The default HTTP adapter is synchronous (requests). Installhttpxfor async support in FastAPI or other async frameworks. - Not persisting the cart key across requests — In web frameworks like Django or FastAPI, store the cart key in the user's session. The SDK doesn't do this automatically outside of scripts.
- Passing wrong types to
add_item()— The first argument isproduct_id(int), second isquantity(int). Variations usevariation_id=456as a keyword argument. - Forgetting to call
.to_dict()— Response objects are not plain dicts. Use.to_dict()to serialize for JSON responses in web frameworks.
When to Load References
- Configuring authentication (guest, Basic Auth, consumer keys, JWT) → references/authentication.md
- Working with cart operations (add, update, remove, coupons, currency) → references/cart.md
- Querying products (list, search, filter, pagination) → references/products.md
WordPress / WooCommerce Requirements
- WooCommerce installed and active
- CoCart plugin installed (free tier available)
- CoCart Plus for advanced features
- Optional: CoCart JWT Authentication for JWT auth
What ships with it: 3 files
4.2 KB alongside SKILL.md
references/
- authentication.md839 B
- cart.md2.9 KB
- products.md514 B