Retrieves a discount rule.
The getDiscountRule()
function returns a Promise that resolves when the specified discount rule is retrieved.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function getDiscountRule(discountRuleId: string): Promise<DiscountRule>;
ID of the discount rule to retrieve.
import { discountRules } from "wix-ecom-backend";
async function getDiscountRule(discountRuleId) {
try {
const result = await discountRules.getDiscountRule(discountRuleId);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.