Greetings! I hope everything is fine. I am facing an issue with the “Dynamic Checkout” buttons in my Shopify theme. When I enable the “Dynamic Checkout” buttons in the theme settings, the product page displays Shopify Payments buttons like “Shop Pay,” which I don’t want to show. Instead, I want the “Buy It Now” button to appear when the “Dynamic Checkout” option is enabled.
Previously, the “Buy It Now” button was appearing as expected. However, after integrating Shopify Payments, the Shopify Payment method buttons are now showing up instead. If I disable the “Dynamic Checkout” buttons, only the “Add to Cart” button remains visible on the product page. But when I enable the “Dynamic Checkout” buttons, the Shopify Payments buttons show up. Currently i am using reformation theme
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';
}
});
});