0

I have a dataset with around 1000 products with fixed prices that only needs to be applied when one certain CouponCode is used.

Does this functionality exist or maybe an extension have this figured out?

1
  • you need to build a custom module for this, no functionality exists for this. Commented Aug 26 at 11:15

1 Answer 1

0

following code you need to use :

add di.xml in following path

app\code\Vendor\Extension\etc

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Quote\Model\CouponManagement">
        <plugin name="checkout_coupon_apply"
                type="Vendor\Module\Plugin\CheckoutCouponApplyAfter"/>
    </type>
</config>

now Add CheckoutCouponApplyAfter.php file in following path :

Vendor\Extension\Plugin\

<?php 

 namespace Vendor\Module\Plugin;

    class CheckoutCouponApply {
    
        public function beforeSet(CouponManagement $subject, $cartId, $couponCode)
        {
             //add product here according to conditions you have
             // Do what you need to do
        }
    }

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.