Sample code for 30+ languages & platforms
Perl

Shopify Delete Product

See more Shopify Examples

Delete a product from the shop.

Chilkat Perl Downloads

Perl
use strict;
use warnings;
use Chilkat2;

my $rest = Chilkat2::Rest->new;

$rest->SetAuthBasic('SHOPIFY_PRIVATE_API_KEY', 'SHOPIFY_PRIVATE_API_SECRET_KEY');

my $success = $rest->Connect('chilkat.myshopify.com', 443, 1, 1);
if (!$success) {
    print $rest->LastErrorText, "\n";
    exit;
}

my $sbResponse = Chilkat2::StringBuilder->new;
$success = $rest->FullRequestNoBodySb('DELETE', '/admin/products/#{id}.json', $sbResponse);
if (!$success) {
    print $rest->LastErrorText, "\n";
    exit;
}

if ($rest->ResponseStatusCode != 200) {
    print 'Received error response code: ', $rest->ResponseStatusCode, "\n";
    print "Response body:\n";
    print $sbResponse->GetAsString(), "\n";
    exit;
}

print "Example Completed.\n";