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?
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?
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
}
}