Enable Cash on delivery option for specific produc

2019-07-29 12:13发布

I have developed the magento website called https://tumree.com and I needto enable COD for test product.

URL: https://tumree.com/test-product I need to enable cash on delivery for above product only. There is a option for disable COD for specific product. But I need to enable for one.

I have tried writing rule in shopping cart rule. But couldn't fix the issue. Pls help me to find the solution...

2条回答
甜甜的少女心
2楼-- · 2019-07-29 12:50

You can use the event payment_method_is_active

You will get the name of the payment method. Use an if condition to check if its COD and then load the items in your quote. Check if its product id matches with your test product and if yes then enable the payment method or else disable it.

The code to disable the payment method is:

$result = $observer->getResult();
$result->isAvailable = false;

where setting it to false disables it.

查看更多
Explosion°爆炸
3楼-- · 2019-07-29 13:03

you can go to System > configuration > Payment method you can enter Maximum order total to "2" and than you can set the test product price to "1" , than it will display COD only for test product.

查看更多
登录 后发表回答