A common question our support team gets is how to change the Payment Types on the checkout page. While the Payment methods shown are set on each contact, in some cases a bit of javaScript can be helpful to reduce or remove the option so that it works better for your clients. Let's get into it...
The two payment types available to contacts are "On Account" and "Credit Card." While you can simply edit the contact's CRM profile to remove one of these options, this doesn't cover all scenarios. For example, sometimes a contact will have access to multiple portals and if on one portal, all contacts should pay by credit card and on the other charge orders to their account, showing the same options on both could be confusing and may cause extra work sorting payments on your end.
To hide the "On Account" payment method on checkout, simply copy and paste the following code into your portal's Custom Javascript box:
$(document).ready(function() {
$('#ddlPaymentMethod option[value="deaa51ed-e249-4ff5-80d9-97941017cbdf"]').hide();
});
To hide the "Credit Card" payment method on checkout, copy and paste the following code into your portal's Custom Javascript box:
$(document).ready(function() {
$('#ddlPaymentMethod option[value="19c3db46-9f35-4e85-a8bf-b6c490c5c2d2"]').hide();
});
Automatically Select a Payment Type
If your contacts on the portal already only have one payment method available on checkout, you can automatically select that option on the checkout page to reduce the amount of clicks they need to make before submitting an order.
To automatically select "On Account", add the following code to your portal's Custom Javascript box:
$(document).ready(function() {
$('#ddlPaymentMethod option[value="deaa51ed-e249-4ff5-80d9-97941017cbdf"]').attr("selected", "true");
});
To automatically select "Credit Card", add the following code to your portal's Custom Javascript box:
$(document).ready(function() {
$('#ddlPaymentMethod option[value="19c3db46-9f35-4e85-a8bf-b6c490c5c2d2"]').attr("selected", "true");
$('#ddlPaymentMethod').trigger('onchange');
});
Hide the Payment Type Altogether
If you would like all contacts on the portal to checkout On Account and not see the Payment Type at all, this can be done by automatically selecting the "On Account" option in the code then hiding the Payment Type on checkout.
First, make sure that all contacts with access to the portal have the On Account option enabled for them to checkout with, otherwise they will get a greyed-out submit button when trying to submit the order.
Lastly, add the following code to your portal's Custom Javascript box:
$(document).ready(function() {
$('#ddlPaymentMethod option[value="deaa51ed-e249-4ff5-80d9-97941017cbdf"]').attr("selected", "true");
$('#pnlPaymentType').hide();
});