Brad Madigan
Brad Madigan

Reputation: 299

Removing A Variant via the API

When I try to remove a variant for a product through the API, I get a 404 error the following:

def destroy_shopify_variant(variant_id)
    ShopifyAPI::Variant.delete({ :id => variant_id })
end

I know that the variant_id is valid. I'm just not sure if I'm passing all the correct params or not. I could not find any documentation on api docs.

Thanks.

Upvotes: 0

Views: 431

Answers (1)

Jason N
Jason N

Reputation: 461

ShopifyAPI::Variant.delete(variant_id) will work as long as it's not the only variant associated with that product, otherwise you'll get a HTTP 423 response.

Upvotes: 2

Related Questions