From cocart
CoCart Swift SDK patterns for headless WooCommerce. Use when setting up CoCart in Swift projects for iOS, macOS, watchOS, tvOS, or visionOS apps.
How this skill is triggered — by the user, by Claude, or both
Slash command
/cocart:swiftThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are an expert in the CoCart Swift SDK (`cocart-headless/cocart-swift-sdk`). When a user adds "use CoCart" to a prompt and their project is Swift-based (iOS, macOS, watchOS, tvOS, visionOS), apply this skill.
You are an expert in the CoCart Swift SDK (cocart-headless/cocart-swift-sdk). When a user adds "use CoCart" to a prompt and their project is Swift-based (iOS, macOS, watchOS, tvOS, visionOS), apply this skill.
Note: The Swift SDK is still in development and not yet production-ready. Mention this when relevant and encourage users to report bugs.
// Package.swift
dependencies: [
.package(url: "https://github.com/cocart-headless/cocart-swift-sdk.git", from: "1.0.0")
]
Or in Xcode: File > Add Package Dependencies > paste the repository URL.
Requirements: Swift 5.9+ / Xcode 15+. iOS 16+, macOS 13+, watchOS 9+, tvOS 16+, visionOS 1+.
import CoCart
let client = CoCart(url: "https://your-store.com")
// Browse products (no auth required)
let products = try await client.products().all()
// Add item to cart (guest session created automatically)
try await client.cart().addItem(productId: 123, quantity: 2)
// Get cart
let cart = try await client.cart().get()
print("Items: \(cart.getItems().count)")
print("Total: \(cart.get("totals.total") ?? "")")
let client = CoCart(
url: "https://your-store.com",
config: CoCartConfig(
cartKey: "existing_cart_key",
username: "[email protected]",
password: "password",
jwtToken: "your-jwt-token",
consumerKey: "ck_xxxxx",
consumerSecret: "cs_xxxxx",
timeout: 30,
maxRetries: 2,
restPrefix: "wp-json",
namespace: "cocart",
mainPlugin: .basic,
etag: true
)
)
try await — All SDK methods are async throwing. Forgetting try or await will cause compile errors. Use do { try await ... } catch { ... } blocks.Bundle.main.infoDictionary for config values and Keychain for secrets. Never commit API keys to source control.@StateObject or in a singleton) and pass it down. Recreating it loses the in-memory cart key.@MainActor for UI updates.npx claudepluginhub cocart-headless/cocart-skills --plugin cocartGuides WooCommerce store setup, payment integration, shipping configuration, customization, and WordPress 7.0 features including AI connectors, DataViews, and collaboration tools.
Implements StoreKit 2 in-app purchases, subscriptions, consumables, non-consumables, and transactions with .storekit testing workflow, StoreManager architecture, and verification.
Builds WooCommerce Gutenberg blocks for cart, checkout, products; extends via Store API, PHP schema, and @woocommerce/blocks-checkout React API.