auto discount for second buy

  • Posts: 170
  • Thank you received: 7
3 years 3 months ago #328318

hi.
Is it possible to get an automatic discount for the second purchase of a product with Hikashop?
for example a user buy a product with 20$ and if user go to reorder that product one month later(not only at the same time), then user get 40% auto-discount and need to pay 12$. is it possible?
this is for registered user only.

Last edit: 3 years 3 months ago by sadaf3d.

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

  • Posts: 81513
  • Thank you received: 13068
  • MODERATOR
3 years 3 months ago #328323

Hi,

So you mean that you want a discount to apply on the second order of a product ? Do you need different discount percentages for different products ? Or is that only for one product that you want that capability ?
What should happen if the user directly purchases 2 of the product ? 3 of the product ?

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

  • Posts: 170
  • Thank you received: 7
3 years 3 months ago #328351

nicolas wrote: Hi,

So you mean that you want a discount to apply on the second order of a product ?

yes i mean discount for second order of that product a user already purchases in the past. (my product is course and we update our course content monthly and i want when that user want reorder that course, then he/she pay less than original price of that course if he purchase in the past)

nicolas wrote: Do you need different discount percentages for different products ? Or is that only for one product that you want that capability ?

maybe but it is not very important if it is problematic way. but if you can advise me about this.

nicolas wrote: What should happen if the user directly purchases 2 of the product ? 3 of the product ?

we set to user only can one quantity per order. we only need implement discount for second order.

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

  • Posts: 4509
  • Thank you received: 611
  • MODERATOR
3 years 3 months ago #328374

Hello,

Maybe there is a way to do this, I will describe you step by step the way to do this :
- First you have to create a sub user group, this mean that to access this discount user have to be registered.
=> Let's call this group premium customer by example.
- Registered
- - Premium Customer


- Create a Mass Action that will automatically mute regular customer (registered) to premium customer if the have some order with your relative product



from these first prerequisites, 2 solutions :
- You directly in your relative product set, a second price only for your premium customer group :


Or
- You create a Coupon and use ACL to restrict only for your premium customer group, and with the "Auto load in cart if possible" option to "Yes".


Both solution, can allow you to have what you request, hope this will fit your needs.
regards

Last edit: 3 years 3 months ago by Philip.
The following user(s) said Thank You: sadaf3d

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

  • Posts: 170
  • Thank you received: 7
3 years 3 months ago #328425

very thanks a lot Philip.
have you any advise to use what Trigger?
"After an order is updated" or "Every days".
can you give me a little describe what is better for my need? what is more safe?

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

  • Posts: 81513
  • Thank you received: 13068
  • MODERATOR
3 years 3 months ago #328438

Hi,

It would be best to user the "after an order is updated" trigger. It will do less processing every day, and it will allow for the change to happens immediately instead of having to wait for the mass action to trigger once a day.

The following user(s) said Thank You: sadaf3d

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

  • Posts: 170
  • Thank you received: 7
3 years 2 months ago #328625

Hi again @Philip @nicolas
i use your way and it is good idea but i have another problem... when i add a user to a usergroup for example "premium customer group" then that user can give discount(or second product's price) for other product too. i want the user that purchase product A only want repeat purchase can use discount and if he want purchase product B, then must use orginal product B price.
for example product A is 10 $ and product B is 20$. if user purchase product A in hist first order he must purchase with 10 $ and if he want pusrchase product A again, then he must pay 5$ and if he want purchase product B , then need to pay 20$. means each product can use it's own order history for discount. need to create separate usergroup for each product?
thank you and wait for you...

Last edit: 3 years 2 months ago by sadaf3d.

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

  • Posts: 4509
  • Thank you received: 611
  • MODERATOR
3 years 2 months ago #328649

Hello,

This is a huge nuance, from this new needs, we see only 1 possibility, create a coupon for each of your required products.
And as well your need to have some sub user group for each product as well.

Like this example :
- premium customer
-- premium customer A
-- premium customer B
-- premium customer C
-- etc...

From this we hope that you haven't to much product that required this feature.
Plus, there are an important point to note, if a customer that are from "premium customer A & B" => Only 1 coupon will be available.
Hope this won't be an issue for fill your needs.

Regards

Last edit: 3 years 2 months ago by Philip.

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

  • Posts: 170
  • Thank you received: 7
2 years 11 months ago #332473

Hi again @Philip @nicolas after long time.
i want write my own plugin to resolve my problem instead use predefined tools in hikashop, because my products maybe go to more and more and i can not moderate that. please advise me about that.(i already create hikashop plugin for custom filtering and other thing)
now i say my need again for reminder:
i want if my user buy product A for second order or more, he pay less than original price of product A. but not any affect on product B.
for example A=20$ but in second order he must pay 15$.
i have two solution according my search in hikashop forum:
1- create plugin (or override core) for coupon system (for example i add more restrict option to ADVANCED RESTRICTIONS tab and set coupon to autoload if it is possible ) for detect users has confirmed order in the past.
2- create plugin (or override core) for reduce product price to which i want for each product differently but where administrator can set percentage of discount (or set second price ) for each product? can i add new Price Restriction option to product page with my own plugin to restrict new price according my own rule? (now my own rule is second price for second order)
thank you

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

  • Posts: 81513
  • Thank you received: 13068
  • MODERATOR
2 years 11 months ago #332475

Hi,

I think that the first solution will be the simplest to implement. The trigger onDiscountBlocksDisplay(&$element, &$html) can be used to push extra options to the coupon form interface. And if you create new columns in the database for them, you can let the system auto save them if their name attribute is

data[discount][xxx]
where xxx is the column name in the hikashop_discount table.
And then you have the trigger onAfterCouponCheck( &$coupon, &$total, &$zones, &$products, &$display_error, &$error_message, &$do ) where you can set $do to false to invalidate a coupon if your check says it can't be used.

The following user(s) said Thank You: sadaf3d

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

  • Posts: 170
  • Thank you received: 7
2 years 11 months ago #332512

thank you nicolas.
i do that and return feedback and if i can create my own plugin , attach here for future users and qualify my code according your comment.

Last edit: 2 years 11 months ago by sadaf3d.

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

  • Posts: 170
  • Thank you received: 7
2 years 11 months ago #332636

nicolas wrote: Hi,

And then you have the trigger onAfterCouponCheck( &$coupon, &$total, &$zones, &$products, &$display_error, &$error_message, &$do ) where you can set $do to false to invalidate a coupon if your check says it can't be used.

i can add successfully advance restricted option for coupon system. is there any trigger like onAfterCouponCheck for discount system? if no, how to implement option for discount if user has canfirmed order in the past, then he can use discount?
(also i can not use coupon because coupon can not show decreased price of product in the list of products or in the list of renewal subscriptions price or other product price page before go to start checkout process. so i need use discount system )

Last edit: 2 years 11 months ago by sadaf3d.

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

  • Posts: 81513
  • Thank you received: 13068
  • MODERATOR
2 years 11 months ago #332648

Hi,

For discounts, you have the trigger onSelectDiscount(&$product, &$discountsSelected, &$discounts, $zone_id, &$parent) that you can use.
- $product contains the information of the current product
- $discountsSelected contains the discounts that the system found as valid for the current product. After that trigger, the system will sort these based on the keys of the array and will use the first one on the prices of the product
- $discounts contains the discounts in $discountsSelected plus some others that were loaded from the database but filtered out based on the categories / products restrictions on them
- $zone_id contains the current zone of the user (based on his address, his geolocated IP address (if geolocation is activated) or the "main tax zone" setting of the HikaShop configuration.
- $parent contains the main product data when $product contains the data of a variant (different variants can potentially have different discounts)

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

Time to create page: 0.083 seconds
Powered by Kunena Forum