Discount for ONLY customers who pay online.

Discount for ONLY customers who pay online.

rickriate
Shopify Partner
3 0 1

Hello,

 

How to create a discount through coding that creates a discount but ONLY for customers who choose to pay online?

 

I did try this using Chat GPT, and it did give me a response, but upon trying to follow the steps, we reached our desired goal. 

 

Could you see what the problem is and why aren't we able to give discounts ONLY to online payment customers?

 

 

This is Chat GPT's response.

 

 

Step 1: Create a new discount code

  • Log in to your Shopify admin panel.
  • Go to the Discounts section under the Discounts & Sales channel.
  • Click on the "Create discount" button.

Step 2: Configure the discount code

  • Enter a unique code for your discount. For example, "PREPAID10" for a 10% discount on prepaid orders.
  • Set the discount type to "Percentage" and enter the desired discount amount.
  • In the "Applies to" section, select "Specific collections, products, or variants."
  • Add all the products or collections that are eligible for the prepaid order discount.

Step 3: Set up payment method conditions

  • Shopify doesn't have built-in functionality to differentiate between payment methods, so you'll need to create a workaround using customer tags.
  • Go to the "Customers" section in your Shopify admin panel.
  • Choose a customer who has placed a prepaid order, or create a new test customer for this purpose.
  • Edit the customer's tags and add a tag like "prepaid" or "discounted."

Step 4: Modify your theme's code

  • From your Shopify admin, go to "Online Store" and then click on "Themes."
  • Find the current theme and click on "Actions," followed by "Edit code."
  • In the code editor, locate the theme.liquid or cart.liquid file.
  • Add the following code snippet just before the closing </head> tag:

 

liquidCopy code
{% if customer and customer.tags contains 'prepaid' %} <style> .discount-code { display: none !important; } </style> {% endif %}
 

This code snippet will hide the discount code field from the checkout page if the customer has the "prepaid" tag.

Step 5: Test the discount

  • Add a product to the cart that is eligible for the prepaid order discount.
  • Proceed to the checkout page and verify that the discount code field is not visible.
  • Complete the checkout process using a prepaid payment method.
  • Confirm that the discount is applied correctly to the order.

By following these steps, you can offer discounts exclusively for prepaid orders in Shopify. Remember to replace "PREPAID10" with your desired discount code and modify the customer tags accordingly.

 

 

 

Replies 2 (2)

MiraPatil
Excursionist
79 0 6

Hello @rickriate 

 

do you have any other discount which have same percentage(%)? 

Ex: if you have 10% off only for to pay online and no other discount for 10% (like welcome10) !

 

Lmk

sniper2804
Shopify Partner
407 25 69

Hi,

Now in 2023, it is possible to implement this using our free app Payment Customizations: PayMix.

You can setup a rule in PayMix to "Show specific payment methods and hide others" when the cart contains discount.

 

Here is a small video to see how the end effect would look like:
If the discount code is applied, only the applicable payment methods would show. Others will be hidden.


We also have in-app live chat support available inside the app to help you with any queries that you might have.

Automate & bulk assign products to shipping profile: Auto Shipping Profiles: Shipr
Calculate accurate shipping rates: Shipping Calculator: ShipMagic
Hide, rename, reorder payment methods at checkout: Payment Customization: PayMix