Update the old price instead of archiving it

Post author
Andrew

Is there a way to update the price of a plan without having to archive the old price? The way that the data is structured on the backend is that it pushes the new price onto the array that holds the prices, but that makes things kind of annoying to deal with on the front end.

What makes it a bit annoying is that archiving the price makes it difficult to dynamically code on the front end to display the new price, since both the archived and the new price are in an array. Some plans will not have any archived price, so I would fetch it getting the first index of the array, while any plan with the second price will have to use the second index of the array.

Comments

2 comments

  • Comment author
    A J

    Hey Andrew, I believe currently it is not possible to directly update the pricing instead of archiving.

    I think that's preferable in cases where there are members who have paid the older price, so getting rid of that might mean losing crucial data for accounting purposes and just to keep things clean and accurate from that aspect.

    Same reason applies for deleting a price, which is not possible if there are any test / live members on that particular priced plan.

    Ahh I get it, I believe in that case, even if there was a way to make the positioning of active price consistent, it would work. Like say active price always is pushed at the first position of the array, it could help us tackle this issue at least from a dynamic perspective

    Yeah I was checking if there is any key-value attribute associated with the prices which stores the state of the prices like active/inactive, you could have filtered the array based on that. The documentation doesn't mention this particular attribute though. Although I was just wondering, that another way to go about it is that if one stores the active price ID as a custom field (but it would mean manually ensuring this is set every time a price is activated) so that you can fetch it in your code, you could search the array for that particular price ID and fetch it regardless of its position in the array. It's definitely a task but just a workaround if nothing else is ideal for your use-case.

    0
  • Comment author
    Andrew

    yeah that would indeed help

    yeah I could try that solution - it would definitely be a bit more of a hacky solution but it would still be preferable to deleting the entire base of users we have for all the price tiers we plan on updating

    is there a potential fix for this coming?

    0

Please sign in to leave a comment.