Hello,
I find that when my customers use a 100% discount code to pay for items, the payment method stored with order is the default payment method I use. I was wondering how I'd change the value of the payment method to something like "Discount Code - Free Item" and save that to the database instead.
I believe this is handled on the checkout_confirmation.php page with something like:
<p class="w-100 mb-1">' . $order->info['payment_method'] . '</p>
So, how would I change this to insert a custom entry in database? I already have this code checking if item is zero rated or not, and it work on my checkout page:
$total_amount = preg_replace('/[^0-9-.]+/ ', '', $currencies->format($order->info['total']));
if ($total_amount > 1.00) {
echo '<p class="w-100 mb-1">' . $order->info['payment_method'] . '</p>';
} else {
echo '<p class="w-100 mb-1">Free Product</p>'; // I want this in database if item is free
}
Thank you for help in advance.
Payment Method
-
- VIP Member
- Posts: 2024
- Joined: Mon Oct 07, 2019 4:39 am
- : Buy Me A Beverage
- Has thanked: 28 times
- Been thanked: 187 times
Re: Payment Method
Maybe a different solution like this - app.php/addons/free_addon/stripe_paymen ... 1185#p1185
Re: Payment Method
I'd like to explore this method you suggested but I need some help with how to do it. Unfortunately, the topic is locked and I can't post to ask author.heatherbell wrote: ↑Wed Apr 06, 2022 5:28 am Maybe a different solution like this - app.php/addons/free_addon/stripe_paymen ... 1185#p1185
-
- VIP Member
- Posts: 2024
- Joined: Mon Oct 07, 2019 4:39 am
- : Buy Me A Beverage
- Has thanked: 28 times
- Been thanked: 187 times
Re: Payment Method
Your question has nothing to do with support for that addon so post questions for help here.
-
- VIP Member
- Posts: 2024
- Joined: Mon Oct 07, 2019 4:39 am
- : Buy Me A Beverage
- Has thanked: 28 times
- Been thanked: 187 times
Re: Payment Method
Have you tried with the advice shown in the link?
I am just following the advice "have a look into the cod module how it is done for virtual orders."
I look there and see https://github.com/CE-PhoenixCart/Phoen ... hp#L28-L32
So, as advised in the link, changing the line https://github.com/CE-PhoenixCart/Phoen ... od.php#L29 to
Code: Select all
if ($GLOBALS['order']->info['total'] > 0) {
Similarly for your "default payment method", as advised in the link,
Code: Select all
if ($GLOBALS['order']->info['total'] == 0) {
Of course, you do not say how shipping is handled so presuming shipping is also free because this would not make sense if a payment is taken for shipping.