rhysnhall / etsy-php-sdk

PHP SDK for Etsy API v3.
MIT License
47 stars 36 forks source link

Listing->delete() has no effect #16

Closed TeagueHarvey closed 1 year ago

TeagueHarvey commented 2 years ago

Hello! I've been loving this SDK, it's been a breeze to upgrade my etsy app from the v2 version to v3.

Recently I was testing out listing functionality and wanted to delete a listing.

$listing = $etsy->getListing($listing_id); $listing->delete();

I know I successfully grabbed the listing and have appropriate scopes, but the listing->delete() call did not work (the listing was still on etsy after the call) and the call did not throw any exceptions. Other functions that I've tested so far like listing->getFiles() works.

Any ideas?

rhysnhall commented 2 years ago

Hey, thanks for the support. Good to see it getting some use! Check out the Etsy docs for the delete method. There are a bunch of requirements that a Listing must meet before it can be deleted. You may have to update it to a draft or drain its stock levels.

Let me know if this doesn't resolve it!

TeagueHarvey commented 2 years ago

Yup, can confirm it's the method that doesn't work. Using the etsy client directly worked for me instead:

$response = Etsy::$client->delete( "/application/listings/$listing_id" );

rhysnhall commented 1 year ago

Latest version has Etsy's updated endpoints which fix this issue.