Show "But it now" Button on product page

There are two kinds of dynamic checkout buttons:

Unbranded and Branded ( You can check the in previous article I shared )
Now when you have 2 different types mean snow you have to identify the classes and hide/show the buttons a/to your need.

e.g.
Css will be:


and JS will be

document.addEventListener("DOMContentLoaded", function () {
    // Select all dynamic checkout buttons
    const paymentButtons = document.querySelectorAll('.shopify-payment-button__button');

    paymentButtons.forEach(button => {
      if (!button.classList.contains('shopify-payment-button__button--unbranded')) {
        // Hide branded payment buttons (e.g., Shop Pay, PayPal)
        button.style.display = 'none';
      } else {
        // Ensure the "Buy Now" button is visible
        button.style.display = 'block';
      }
    });
  });