ShopifySharp
ShopifySharp copied to clipboard
Support DiscountCodes lookup
Shopify supports a lookup of a discount code from the code: https://shopify.dev/docs/admin-api/rest/reference/discounts/discountcode#lookup-2020-10
Would be good to support this in this SDK.
We did this ourselves, but would be great to get it baked in:
public async Task<PriceRuleDiscountCode> LookupAsync(
string discountCode,
CancellationToken cancellationToken = default)
{
var uri = PrepareRequest("discount_codes/lookup.json");
uri.QueryParams.Add("code", discountCode);
var response = await ExecuteRequestAsync<PriceRuleDiscountCode>(uri, HttpMethod.Get, cancellationToken);
return response.Result;
}
Thanks for the link! I didn't know they had added this feature, I'd be happy to add it to the package.