Sample code for 30+ languages & platforms
Ruby

Shopify Delete Product

See more Shopify Examples

Delete a product from the shop.

Chilkat Ruby Downloads

Ruby
require 'chilkat'

success = false

rest = Chilkat::CkRest.new()

rest.SetAuthBasic("SHOPIFY_PRIVATE_API_KEY","SHOPIFY_PRIVATE_API_SECRET_KEY")

success = rest.Connect("chilkat.myshopify.com",443,true,true)
if (success != true)
    print rest.lastErrorText() + "\n";
    exit
end

sbResponse = Chilkat::CkStringBuilder.new()
success = rest.FullRequestNoBodySb("DELETE","/admin/products/#{id}.json",sbResponse)
if (success != true)
    print rest.lastErrorText() + "\n";
    exit
end

if (rest.get_ResponseStatusCode() != 200)
    print "Received error response code: " + rest.get_ResponseStatusCode().to_s() + "\n";
    print "Response body:" + "\n";
    print sbResponse.getAsString() + "\n";
    exit
end

print "Example Completed." + "\n";