Enable Cash on delivery option for specific product(one product)

前提是你 提交于 2019-12-24 16:45:58

问题


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...


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/38243730/enable-cash-on-delivery-option-for-specific-productone-product

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!