[Skip to main content](#vessel-content)

#   Use Discount only with coupon

##

- **[workspace](/forum/user/58281-workspace "View workspace's Profile")**
- [![workspace's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58281-workspace "View workspace's Profile") Topic Author
- [ Offline](/forum/user/58281-workspace)

Less More

- Posts: 27
- Thank you received: 0
-
-

6 years 11 months ago [\#313924](#313924) by [workspace](/forum/user/58281-workspace "View workspace's Profile")  *[Use Discount only with coupon](/forum/46-discount-coupon/898841-use-discount-only-with-coupon#313924 "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.")* was created by *[workspace](/forum/user/58281-workspace "View workspace's Profile")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84OTg4NDEtdXNlLWRpc2NvdW50LW9ubHktd2l0aC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Philip](/forum/user/34318-philip "View Philip's Profile")**
- [![Philip's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34318-philip "View Philip's Profile")
- [ Offline](/forum/user/34318-philip)

Less More

- Posts: 4820
- Thank you received: 652
-
-

6 years 11 months ago -  6 years 11 months ago [\#313929](#313929) by [Philip](/forum/user/34318-philip "View Philip's Profile")  Replied by *[Philip](/forum/user/34318-philip "View Philip's Profile")* on topic *[Use Discount only with coupon](/forum/46-discount-coupon/898841-use-discount-only-with-coupon#313929 "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.")*

Hello,

You have the HikaShop coupon system :

[ ![alt](https://i.imgur.com/VRh8Z4Z.png) ](https://i.imgur.com/VRh8Z4Z.png "alt")

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 11 months ago by [Philip](/forum/user/34318-philip "View Philip's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84OTg4NDEtdXNlLWRpc2NvdW50LW9ubHktd2l0aC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[workspace](/forum/user/58281-workspace "View workspace's Profile")**
- [![workspace's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58281-workspace "View workspace's Profile") Topic Author
- [ Offline](/forum/user/58281-workspace)

Less More

- Posts: 27
- Thank you received: 0
-
-

6 years 11 months ago [\#313989](#313989) by [workspace](/forum/user/58281-workspace "View workspace's Profile")  Replied by *[workspace](/forum/user/58281-workspace "View workspace's Profile")* on topic *[Use Discount only with coupon](/forum/46-discount-coupon/898841-use-discount-only-with-coupon#313989 "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.")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84OTg4NDEtdXNlLWRpc2NvdW50LW9ubHktd2l0aC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Philip](/forum/user/34318-philip "View Philip's Profile")**
- [![Philip's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34318-philip "View Philip's Profile")
- [ Offline](/forum/user/34318-philip)

Less More

- Posts: 4820
- Thank you received: 652
-
-

6 years 10 months ago -  6 years 10 months ago [\#314007](#314007) by [Philip](/forum/user/34318-philip "View Philip's Profile")  Replied by *[Philip](/forum/user/34318-philip "View Philip's Profile")* on topic *[Use Discount only with coupon](/forum/46-discount-coupon/898841-use-discount-only-with-coupon#314007 "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.")*

Hello,

Have a look on my screenshot :

[ ![alt](https://i.imgur.com/bGax4ad.png) ](https://i.imgur.com/bGax4ad.png "alt")

This option allow to only apply the coupon on products in the cart as requested.
Regards

Last edit: 6 years 10 months ago by [Philip](/forum/user/34318-philip "View Philip's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84OTg4NDEtdXNlLWRpc2NvdW50LW9ubHktd2l0aC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[workspace](/forum/user/58281-workspace "View workspace's Profile")**
- [![workspace's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58281-workspace "View workspace's Profile") Topic Author
- [ Offline](/forum/user/58281-workspace)

Less More

- Posts: 27
- Thank you received: 0
-
-

6 years 10 months ago -  6 years 10 months ago [\#314046](#314046) by [workspace](/forum/user/58281-workspace "View workspace's Profile")  Replied by *[workspace](/forum/user/58281-workspace "View workspace's Profile")* on topic *[Use Discount only with coupon](/forum/46-discount-coupon/898841-use-discount-only-with-coupon#314046 "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.")*

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 10 months ago by [workspace](/forum/user/58281-workspace "View workspace's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84OTg4NDEtdXNlLWRpc2NvdW50LW9ubHktd2l0aC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86556
- Thank you received: 14304
-
-

6 years 10 months ago [\#314056](#314056) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Use Discount only with coupon](/forum/46-discount-coupon/898841-use-discount-only-with-coupon#314056 "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.")*

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](https://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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84OTg4NDEtdXNlLWRpc2NvdW50LW9ubHktd2l0aC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[workspace](/forum/user/58281-workspace "View workspace's Profile")**
- [![workspace's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58281-workspace "View workspace's Profile") Topic Author
- [ Offline](/forum/user/58281-workspace)

Less More

- Posts: 27
- Thank you received: 0
-
-

6 years 10 months ago [\#314074](#314074) by [workspace](/forum/user/58281-workspace "View workspace's Profile")  Replied by *[workspace](/forum/user/58281-workspace "View workspace's Profile")* on topic *[Use Discount only with coupon](/forum/46-discount-coupon/898841-use-discount-only-with-coupon#314074 "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.")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84OTg4NDEtdXNlLWRpc2NvdW50LW9ubHktd2l0aC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86556
- Thank you received: 14304
-
-

6 years 10 months ago [\#314076](#314076) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Use Discount only with coupon](/forum/46-discount-coupon/898841-use-discount-only-with-coupon#314076 "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.")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84OTg4NDEtdXNlLWRpc2NvdW50LW9ubHktd2l0aC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[workspace](/forum/user/58281-workspace "View workspace's Profile")**
- [![workspace's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58281-workspace "View workspace's Profile") Topic Author
- [ Offline](/forum/user/58281-workspace)

Less More

- Posts: 27
- Thank you received: 0
-
-

6 years 10 months ago [\#314092](#314092) by [workspace](/forum/user/58281-workspace "View workspace's Profile")  Replied by *[workspace](/forum/user/58281-workspace "View workspace's Profile")* on topic *[Use Discount only with coupon](/forum/46-discount-coupon/898841-use-discount-only-with-coupon#314092 "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.")*

And how do I do that? What code do I need to add?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84OTg4NDEtdXNlLWRpc2NvdW50LW9ubHktd2l0aC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Philip](/forum/user/34318-philip "View Philip's Profile")**
- [![Philip's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34318-philip "View Philip's Profile")
- [ Offline](/forum/user/34318-philip)

Less More

- Posts: 4820
- Thank you received: 652
-
-

6 years 10 months ago -  6 years 10 months ago [\#314104](#314104) by [Philip](/forum/user/34318-philip "View Philip's Profile")  Replied by *[Philip](/forum/user/34318-philip "View Philip's Profile")* on topic *[Use Discount only with coupon](/forum/46-discount-coupon/898841-use-discount-only-with-coupon#314104 "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.")*

Hello,

Of course, in order to process this kind of custom **advanced html &amp; 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-&gt;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 10 months ago by [Philip](/forum/user/34318-philip "View Philip's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84OTg4NDEtdXNlLWRpc2NvdW50LW9ubHktd2l0aC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[workspace](/forum/user/58281-workspace "View workspace's Profile")**
- [![workspace's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58281-workspace "View workspace's Profile") Topic Author
- [ Offline](/forum/user/58281-workspace)

Less More

- Posts: 27
- Thank you received: 0
-
-

6 years 9 months ago [\#314863](#314863) by [workspace](/forum/user/58281-workspace "View workspace's Profile")  Replied by *[workspace](/forum/user/58281-workspace "View workspace's Profile")* on topic *[Use Discount only with coupon](/forum/46-discount-coupon/898841-use-discount-only-with-coupon#314863 "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.")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84OTg4NDEtdXNlLWRpc2NvdW50LW9ubHktd2l0aC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86556
- Thank you received: 14304
-
-

6 years 9 months ago [\#314877](#314877) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Use Discount only with coupon](/forum/46-discount-coupon/898841-use-discount-only-with-coupon#314877 "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.")*

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](https://www.hikashop.com/support/contact-us.html)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84OTg4NDEtdXNlLWRpc2NvdW50LW9ubHktd2l0aC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.065 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
