Skip to content

kirpalsingh17/Shopify-Script-Prepaid-Order-Discount-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Shopify-Script-Prepaid-Order-Discount-Code

Shopify Scripts for Prepaid Order by Discount Code

Shopify provides many features to extend functionality of core Shopify store. One of them is giving permission to create Shopify scripts. With these Shopify scripts, we can manipulate Shopify cart and checkout page.

Here, We are going to create script for discount code which apply to give discount and remove COD payment method.

Offer discount code if opt for the prepaid option

  • Install Shopify script app (https://apps.shopify.com/script-editor)
  • Create discount code PREPAIDOFFER
  • Show Banner with prepaid discount PREPAIDOFFER
  • Create new payment script and copy code from this file to hide COD.
Input.payment_gateways.each do |payment_gateway|
  if payment_gateway.name == "Cash on Delivery"
  else 
    payment_gateway.change_name(payment_gateway.name + " \n (Use coupon code 'PREPAIDOFFER' for 5% off on this payment method)");
  end 
end

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 == "PREPAIDOFFER"
end

About

Shopify Scripts for Prepaid Order by Discount Code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages