Updates a loyalty reward.
Use this endpoint to update details of a reward, such as the name, whether or not a reward is active, or the amount of points it costs to redeem. Also use this endpoint to add new tiers that are eligible to redeem a reward.
You may not change the type
of a reward. That is set upon creation and cannot be updated.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function updateReward(
_id: string,
reward: UpdateReward,
): Promise<UpdateRewardResponse>;
Reward ID.
Reward info to update.
import { rewards } from "wix-loyalty.v2";
async function updateReward(id, reward) {
try {
const result = await rewards.updateReward(id, reward);
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.