Option for current customers to generate coupons for new customer

  • Posts: 26
  • Thank you received: 1
  • Hikashop Business Hikashop Essential
2 years 11 months ago #332038

Hi,

We want to run an action: "bring us a new customer and both get a discount!"

So a customer, at the moment that he makes a purchase, gets a coupon code for a friend.
He sends it to the friend.
Upon the first purchase of the friend, the old customer gets a coupon code himself, valid for his next purchase.

Obviously, the friend must be a new customer and the old customer should not be able to use the first coupon.

Can this be done and how?

Best,
Eric

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
2 years 11 months ago #332042

Hi,

There is no option for that.
With AcyMailing, you can create a campaign so that each customer, after their first order will get an email with a dynamically generated coupon code.
There is however no mechanism to prevent people who already purchased to use the coupon code.
You could do that by having the coupon generator tag in AcyMailing's integration with HikaShop to support the "access level" setting of coupon. That way, you could restrict generated coupons to guests and "registered" users, while move your users with at least one order to another user group with a mass action.
And then, since each user would get a personal coupon code, you could manually check the orders and link them back to the original user to create a coupon for them. Automating that part would then be possible with a custom made plugin.

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

  • Posts: 26
  • Thank you received: 1
  • Hikashop Business Hikashop Essential
2 years 11 months ago #332069

Hi,

First of all, I want to generate a coupon that user1 (exsisting customer) can forward to user2 (new customer).
That can be done with Acymailing, and user 1 can forward the mail to the new customer.
So the new customer can instantly use the coupon on the first order.

You could do that by having the coupon generator tag in AcyMailing's integration with HikaShop to support the "access level" setting of coupon. That way, you could restrict generated coupons to guests and "registered" users

This can not work. In the Acymailing integration, I can not set a coupon validity for a certain user group, nor individual user.
Apart from the amount / percentage, dates, you can only set Product, Quota and Quota per user.

So is there no way to prevent the coupon code to be used by user1?

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
2 years 11 months ago #332077

Hi,

Indeed. That's what I said. That's why I said you should ask AcyMailing's integration to add the support for the "access level" setting of coupons. Then it would be possible.

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

  • Posts: 26
  • Thank you received: 1
  • Hikashop Business Hikashop Essential
2 years 11 months ago #332097

Hi,

Is it an idea to have the option to exclude an individual customer, rather than include a whole group?
I know it would mean a modification of both Hikashop an Acymailing, but still ...

And another idea: could PHP be included as one of the mass actions? Currently it's only possible to do an SQL query, but this is kind of limited.
It would help a lot tackle questions like this.

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
2 years 11 months ago #332103

Hi,

There is a setting "users" in coupons in Hikashop where you can select a list of users allowed to use the coupon. So we could indeed add an opposite setting to prevent the users selected to use the coupons.
But as you said, in that case, on top of having AcyMailing add the option, it would also require us to add it.

Having the possibility to add PHP code to mass actions is an interesting idea. We'll look into it.

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

  • Posts: 26
  • Thank you received: 1
  • Hikashop Business Hikashop Essential
2 years 11 months ago #332128

HI,

Yes it would involve 2 changes, both in Hika and Acy. But would be nice to have!

Or is there an other way to make a coupon not usable for the first customer?
I mean, I could copy it into an order of that customer, but that could lead to a lot of confusion for the shop owner.

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
2 years 11 months ago #332131

Hi,

well, the best would be to do a custom development of a plugin so that you could implement the onAfterCouponCheck( &$coupon, &$total, &$zones, &$products, &$display_error, &$error_message, &$do ) trigger and do the check of the user yourself in the code of that function. If the coupon code should not be used by the current user, you could just set $do to false and set the error message in $error_message.

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

  • Posts: 26
  • Thank you received: 1
  • Hikashop Business Hikashop Essential
2 years 11 months ago #332164

Hi,

In that case there still should be some reference inside the coupon to recognise it and the plugin to make sure the user who initiated it can only give it away, and never use it himself, including current and next orders.
That is already close to a built-in option in Hikashop to make a coupon NOT useable for a (group of) users, would make life a lot easier!

And how to solve the second step: automatically give the first user a coupon when a give-away coupon was used?
We could do that manually, of course, but automation is always better!

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
2 years 11 months ago #332166

Hi,

As I said, you can use AcyMailing to generate the coupon. And with it, you can for example include the user_id in the coupon code.
That way, you do have the reference inside the coupon so that in onAfterCouponCheck you can extract the user_id from the coupon code to check if there current user_id is the same or not and if not, block it.
So really, it's just a few lines of code in a Joomla plugin:

function onAfterCouponCheck( &$coupon, &$total, &$zones, &$products, &$display_error, &$error_message, &$do )  {
$user_id = $coupon->discount_code; // extract the user_id from the coupon code based on the coupon code format user in AcyMailing coupon tag. Here we just assume the user_id is used as the coupon code.
if(hikashop_loadUser() === $user_id) $do = false;
}

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

Time to create page: 0.073 seconds
Powered by Kunena Forum