Skip to content

WooCommerce SDK for iOS, OS X, tvOS and watchOS, written purely in Swift.

License

Notifications You must be signed in to change notification settings

flyman27/WooCommerceSDK

 
 

Repository files navigation

WooCommerceSDK

Build Status Carthage compatible

A wrapper around WooCommerce REST API for iOS, OS X, tvOS and watchOS, written purely in Swift.

Requirements

  • iOS 8.0+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 7.2+
  • WooCommerce 2.4+

Usage

Initialize the client once anywhere in your app (preferred to be in your AppDelegate).

let client = Client.sharedClient

client.siteURL = "https://example.com"
client.consumerKey = "YOUR_API_CONSUMER_KEY"
client.consumerSecret = "YOUR_API_CONSUMER_SECRET"

Get an Order

let orderId = 12
Order.get(orderId) { success, order in
    print(order)
}

Get a Customer

let customerId = 2
Customer.get(customerId) { success, customer in
    print(customer)
}

Get Customer Orders

let customerId = 2
Customer.getOrders(customerId) { success, orders in
    print(orders)
}

Get a Product

let productId = 8
Product.get(orderId) { success, product in
    print(product)
}

Get List of Product Categories

ProductCategory.getAll(limit: 100, completion: { success, categories in
    print(categories)
})

Get All Products by Category

var category = ProductCategory()
category.slug = "hoodies"
Product.getAll(byCategory: category) { success, products
    print(products)
}

Installation

Add this to your Cartfile:

github "thii/WooCommerceSDK"

then

$ carthage update

License

MIT

About

WooCommerce SDK for iOS, OS X, tvOS and watchOS, written purely in Swift.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 99.2%
  • Objective-C 0.8%