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

how can I remove the "pay now" button from order status pages for wholesale orders?

Solved

how can I remove the "pay now" button from order status pages for wholesale orders?

RLJackson
Excursionist
20 2 6

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}."

Accepted Solution (1)

Small_Task_Help
Shopify Partner
1144 55 112

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

To Get Shopify Experts Help, Click Here or E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Developers India
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad

View solution in original post

Replies 2 (2)

Small_Task_Help
Shopify Partner
1144 55 112

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

To Get Shopify Experts Help, Click Here or E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Developers India
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad
RLJackson
Excursionist
20 2 6

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!