All things Shopify and commerce
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
We have some wholesale customers who have net 30 payment terms, but we require that they pay by check for these orders. Recently we had one of these customers find the "pay now" button on their order status page, and paid by credit card, so we had to pay the service fee on top of the wholesale discount we were giving them. I would like to prevent this from happening in the future, but I'm not sure of how to code the changes I would like.
The logic that I would like to apply to the page:
If order is tagged "wholesale" and payment terms are "within 30 days" then I would like the "pay now" button to not be displayed. If possible I would also like to add the message "Please send checks to [company address}."
Solved! Go to the solution
This is an accepted solution.
Hi,
Hope this will help
- Order status page section . Add Logic to Hide Button for Wholesale Orders
Code example
<script>
document.addEventListener("DOMContentLoaded", function () {
// Check if order has 'wholesale' tag and net 30 terms
var tags = "{{ order.tags }}";
var paymentTerms = "{{ order.payment_terms.name }}";
// Clean and lowercase tags for safe comparison
var tagList = tags.toLowerCase().split(", ");
if (tagList.includes("wholesale") && paymentTerms.toLowerCase().includes("30")) {
// Hide Pay Now button
var payButton = document.querySelector('[data-tg-refresh="payment_gateway"]');
if (payButton) {
payButton.style.display = "none";
}
// Add a message instead
var message = document.createElement("p");
message.textContent = "Please send checks to [Your Company Address].";
message.style.color = "red";
message.style.fontWeight = "bold";
var targetArea = document.querySelector(".main__content") || document.body;
targetArea.prepend(message);
}
});
</script>
- Replace Placeholder
This is an accepted solution.
Hi,
Hope this will help
- Order status page section . Add Logic to Hide Button for Wholesale Orders
Code example
<script>
document.addEventListener("DOMContentLoaded", function () {
// Check if order has 'wholesale' tag and net 30 terms
var tags = "{{ order.tags }}";
var paymentTerms = "{{ order.payment_terms.name }}";
// Clean and lowercase tags for safe comparison
var tagList = tags.toLowerCase().split(", ");
if (tagList.includes("wholesale") && paymentTerms.toLowerCase().includes("30")) {
// Hide Pay Now button
var payButton = document.querySelector('[data-tg-refresh="payment_gateway"]');
if (payButton) {
payButton.style.display = "none";
}
// Add a message instead
var message = document.createElement("p");
message.textContent = "Please send checks to [Your Company Address].";
message.style.color = "red";
message.style.fontWeight = "bold";
var targetArea = document.querySelector(".main__content") || document.body;
targetArea.prepend(message);
}
});
</script>
- Replace Placeholder
Thank you! This looks like what I need, but I've just realized that I can't use liquid to customize this page, since we've switched to new accounts. I appreciate your help, though!