recurring discount

  • Posts: 334
  • Thank you received: 5
  • Hikashop Business
2 months 5 days ago #337031

-- HikaShop version -- : 4..1.1
-- Joomla version -- : 3.10.2
-- PHP version -- : 7.4.x


Is there the option within Hikashop to set a recurring discount? For example, every Thursday a 10% discount on a certain category or product?
Or is there a specific plugin for this?



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

  • Posts: 74542
  • Thank you received: 11497
2 months 3 days ago #337051


There is no direct option to do that.
However, you could create a mass action with a trigger "every week" and an action "run MySQL query" and the MySQL query being:

UPDATE #__hikashop_discount SET discount_start = discount_start + 604800, discount_end = discount_end + 604800 WHERE discount_code = 'XXX';
and you need to replace XXX by the code of the discount you wish to make recurring.
Note that 604800 is the number of seconds in 1 week.
Note also that this require the cron task to be running :
Note also that this mass action will run once directly after the next tic of the cron task. So you should create that mass action when the validity of the discount is in the past, less than 1 week.
For example, if I create a discount for tomorrow and I want it to be recurring, I need to wait 2 days to create the mass action.
Finally, note also that after you create the mass action, it won't run immediately since it will run on the next tic of the cron task. So I would recommend you to wait 1h after you created it to check that the discount dates were properly updated.

The following user(s) said Thank You: easyconnect83

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

Time to create page: 0.054 seconds
Powered by Kunena Forum