Possible to modify price onBeforeSubscriptionUpdate on a recurring subscription

  • Posts: 88
  • Thank you received: 19
1 year 7 months ago #343795

-- HikaShop version -- : 4.6.1
-- HikaSerial version -- : 4.0.1
-- Joomla version -- : 4.1.5
-- PHP version -- : 8.0

Hi

When a recurring subscription is renewed with Hikaserial Subscription, it looks like it uses the first subscription as a "master" and copies the data from that. I have a special case where users are discounted if they have more than one active subscription. I can control the price using joomla user groups and create special prises for those groups in Hikashop. However, I have issues with renewal when they no longer meet the requirements for discount.

My case looks like this:

User buys first subscription. They are added to the "tier 1" user group.
First subscription is now active. The recurring price remains the same.

User buys second subscription. User now have 2 active subscriptions. As the user is in "tier 1" user group, the user is discounted for the price of the second subscription. Second subscription is now active and recurring price is the discounted price.

Until now, everything is fine and works as intended.

My challenge is: User cancel the first subscription. User now have 1 active subscription and so remain in "tier 1" user group. But with only one active subscription, the price of the second subscription should no longer be discounted. But because user was discounted in the beginning, and that this subscription is used as a "master" for renewals, the price remains discounted.

I'm considering my options here.

E.g. could we have a toggle in Hikaserial subscription configuration to use plan price on every renewal instead of price of plan on purchase? Then the price of the subscription would always match the current plan and the prices set for the user groups. That would be best case scenario. Is this something you would consider?

Else, can I use onBeforeSubscriptionUpdate hook to modify the price?

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
1 year 7 months ago #343809

Hello,

Instead of creating a recurring system directly in HikaSerial, we preferred to include it in the HikaShop core (so other plugins/add-ons could use it too).
So the HikaSerial triggers won't help you for that specific task since HikaSerial will be called once the recurring sub-order is confirmed.

But you do have some HikaShop triggers which would help you, like :
onBeforeCreateRecurringSuborder

The recurring payment plugin you're using (bambora) is using that HikaShop API and use the special method "createRecurringSuborder" to create a new order by copying (more complicated than that) the original order.
It's what you called the "master" order.
Once that recurring order created, the payment plugin is doing its check-up and confirm the order ; that confirmation will perform the subscription renewal in HikaSerial.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.056 seconds
Powered by Kunena Forum