2

I have been looking for event || Plugin || Whatsoever !!

I have a rule that will apply to the customer only one time, without using coupon code.

I am willing to add some conditional statements before that discount(Cart Price Rule) applied to customer cart.

How to do that? what's possible way?

UPDATE

I am trying to find a way to give the discount to users who subscribe to our newsletter.

If they subscribed to the newsletter than they will get $5 fixed price discount on their first purchase without using any coupon code.

5
  • Can you explain the question a bit more? Commented Jul 4, 2018 at 10:39
  • I've added more details Mohit please check. Give me some guide.
    – TBS Mage
    Commented Jul 4, 2018 at 10:44
  • Means you want to show some kind of message if the discount applies. Am I right? Commented Jul 4, 2018 at 10:57
  • No need for message Also no need for coupon code , Just need to give discount of $5, If user/customer is subscribed and cart total is greater than $30.
    – TBS Mage
    Commented Jul 4, 2018 at 10:59
  • I have posted my answer. Please check and let me know if it helped. Commented Jul 4, 2018 at 12:51

1 Answer 1

1

I have created a custom module to provide a particular discount on first order if the user has subscribed to the newsletter.

Since the module has many files, I could not post the code here.

Please check this link to download the module.

Update: condition for checking subtotal

  1. Open app/code/Stack/NewsletterDiscount/Model/Total/Quote/NewsletterDiscount.php and find code like this:
if ( !$program->getId() || !$this->service->canGetDiscount($email) ) {
  1. Replace it with:
if ( !$program->getId() || !$this->service->canGetDiscount($email, $subtotal) ) {
  1. Get the value of subtotal in variable $subtotal before above condition.

  2. Now open app/code/Stack/NewsletterDiscount/Model/Service.php and change the line:

public function canGetDiscount($email) {

to

public function canGetDiscount($email, $amount) {
  1. In the same file find below code:
if ( $isValidSubscriber && $discountTimes < $maxTimes ) {

and replace above line of code with:

if ( $isValidSubscriber && $discountTimes < $maxTimes && $amount > 30) {

Please follow the instructions in the readme file and let me know if it helped.

2
  • Thanks for your time, Your work is amazing but I need to give discount only if subtotal is above 30 How can i do with this ?
    – TBS Mage
    Commented Jul 4, 2018 at 13:06
  • @TBSMage, please check my updated answer. Above steps are for hint only. You will need to write code as per your requirement. Commented Jul 4, 2018 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.