Sample code for 30+ languages & platforms
Swift

Shopify Delete Product

See more Shopify Examples

Delete a product from the shop.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let rest = CkoRest()!

    rest.setAuthBasic(username: "SHOPIFY_PRIVATE_API_KEY", password: "SHOPIFY_PRIVATE_API_SECRET_KEY")

    success = rest.connect(hostname: "chilkat.myshopify.com", port: 443, tls: true, autoReconnect: true)
    if success != true {
        print("\(rest.lastErrorText!)")
        return
    }

    let sbResponse = CkoStringBuilder()!
    success = rest.fullRequestNoBodySb(httpVerb: "DELETE", uriPath: "/admin/products/#{id}.json", sb: sbResponse)
    if success != true {
        print("\(rest.lastErrorText!)")
        return
    }

    if rest.responseStatusCode.intValue != 200 {
        print("Received error response code: \(rest.responseStatusCode.intValue)")
        print("Response body:")
        print("\(sbResponse.getAsString()!)")
        return
    }

    print("Example Completed.")

}