Shopify offers Script Editor app for Shopify Plus Merchants which provides much more flexibility than Shopify APIs. The scripts are written on Ruby and can be used to build complex logic on the checkout page where Shopify apps generally do not have any control.
Here is a short script I wrote which allows user to provide Discounts only on Cash On Delivery Orders.
Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway| payment_gateway.name == "Cash on Delivery" && Input.cart.discount_code && Input.cart.discount_code.code == "PREPAID" end
In the above code as soon as user enter PREPAID as the coupon code, they get a discount set as per the discount code and Cash on Delivery is hidden, which would then become visible only when the coupon code is removed. This is handy trick that Shopify Plus owners should use for converting your COD orders into prepaid.
You may also want to rename your prepaid gateway with a text talking about discount code.
Input.payment_gateways.each do |payment_gateway| next unless payment_gateway.name == "PayUbiz" payment_gateway.change_name("PayUbiz \n (Use coupon code 'CASHBACK' for 5% off on this payment method)") end
34,145 total views, 16 views today