Scripts are flexible and can be used to create unique and powerful discounts. For example, you can create scripts that change the prices and properties of line items in your online store's cart based on the items that a customer adds to it.
You can find examples of common scripts in the script templates that are provided in the Script Editor. To view these examples, you need to create a script.
Here are some other script examples:
Percentage off all items
This line item script multiplies the price of each line item in the cart by 0.9, resulting in a 10% discount.
Percentage off all shipping rates
This shipping script discounts all shipping rates by 0.10, resulting in a 10% discount on shipping.
Remove a shipping rate
This shipping script hides shipping options that start with the string EXPRESS.
Rename a payment gateway
The following script renames the Cash on Delivery (COD) payment gateway to a custom name.
You can check a cart's discount code and apply any discounts as necessary.
Stop customers from using a discount code
You can use a line item script to temporarily stop customers from applying a discount code at checkout. For example, during a Black Friday Cyber Monday sale, the following script will tell your customers that their discount code can't be used:
If you have a Shopify Plus plan, you can remove the Discount code field from your checkout. To remove this field, add the following code to your checkout.liquid file.