Skip to main content

Use Discount only with coupon

More
6 years 9 months ago #313924 by workspace
Hi there, I'd like to know if it's possible to make a discount only work with a coupon code? I want to apply $5 off every item in an order, but only if they have a valid code.

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

More
6 years 9 months ago - 6 years 9 months ago #313929 by Philip
Hello,

You have the HikaShop coupon system :



Don't forget that in every HikaShop settings screen you have the help buttons to see the documentation.
Hope this help you to get what you need.

Regards
Last edit: 6 years 9 months ago by Philip.

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

More
6 years 9 months ago #313989 by workspace
Hi there, this does not solve my problem. Coupons only take an amount of an entire cart. I want to take $5 off the price of each item in the cart.

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

More
6 years 9 months ago - 6 years 9 months ago #314007 by Philip
Hello,

Have a look on my screenshot :



This option allow to only apply the coupon on products in the cart as requested.
Regards
Last edit: 6 years 9 months ago by Philip.

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

More
6 years 9 months ago - 6 years 9 months ago #314046 by workspace
Hi there, this only makes the coupon apply to the product only, it does not apply if there are multiple products purchased.

I.e. if I buy 2 items for $100 and have a $10 coupon code, I want the price of each item to now be $90. I don't want to subtract $10 from the total cost of $200.
Last edit: 6 years 9 months ago by workspace.

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

More
6 years 9 months ago #314056 by nicolas
Hi,

If you use the "percentage" field of the coupon then you can have the value of the coupon based on the value of each product in the cart.

But if you enter a fixed value, then it will be fixed for the whole cart, regardless of the number of products in the cart.

Now, there is no option to have a coupon code validate a discount value which will be calculated as a fixed amount multiplied by the number of products in the cart with HikaShop's default features. What you could check then is AWOCoupon:
awodev.com/products/joomla/awocoupon
It is a coupon system compatible with HikaShop which supports much more advanced options and rules than HikaShop's coupon system. So it might be able to do that. You should check with their support.

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

More
6 years 9 months ago #314074 by workspace
Is it possible to make some adjustments to the back-end code to achieve this. While the AwoCoupon plugin may achieve what we're looking for, it has a bunch of unneeded features. All we're looking to do is make it so that the coupon code is applied based on the quantity in the cart. So if there is 5 of the items, the code is applied 5 times.

Can we add some code in the back end to achieve this?

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

More
6 years 9 months ago #314076 by nicolas
Hi,

Sure. You would have to edit the file administrator/components/com_hikashop/classes/discount.php when the coupon value is calculated in order to multiply its value by the quantity of the products in the cart.

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

More
6 years 9 months ago #314092 by workspace
And how do I do that? What code do I need to add?

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

More
6 years 9 months ago - 6 years 9 months ago #314104 by Philip
Hello,

Of course, in order to process this kind of custom advanced html & php knowledge is required.
Now, to help you follow me step by step :
- In your file administrator/components/com_hikashop/classes/discount.php
- Go in this file to the recalculateDiscountValue function
- Find where the "$coupon->discount_flat_amount" is used to process calculation, and modify it like Nicolas guide you OR like you need to be processed.

Note : Take care to process your modification in each case in order to have a consistent results for each case, especially for product variants, and to keep this logical with your taxes settings.

Hope this will help you to get what you need.
Regards
Last edit: 6 years 9 months ago by Philip.

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

More
6 years 8 months ago #314863 by workspace
Hi there, can you specifically say which line I need to adjust as I did not write your code so I don't know what does what. What do I need to change so that the coupon code (not discount) is applied based on the number of an item in the cart?

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

More
6 years 8 months ago #314877 by nicolas
Hi,

It will be hard to do that on the fly here. It requires a dozen of lines of codes to be written and tested. If you want us to work on such customization project for you, that's possible. In that case, you can use our contact form to request a quote with a link on this thread:
www.hikashop.com/support/contact-us.html

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

Time to create page: 0.228 seconds
Powered by Kunena Forum