Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Customize Selected Shipping Method’s Title in WooCommerce Cart?

Want to improve the look and feel of your WooCommerce cart? Here’s a simple snippet that lets you add custom styles to the shipping options. By using this, you can dynamically change the color of the text based on the selected shipping method. This improves the visibility of the selected option, making it easier for users to identify their preferred shipping method.

add_action('wp_head', 'ts_advanced_custom_cart_shipping_styles');

function ts_advanced_custom_cart_shipping_styles() {
    if (is_cart()) {
        echo '<style>
            /* Additional styles for radio buttons and labels */
            input[type=radio]+label {
                font-size: 20px;
                margin-right: 10px;
            }
            input[type=radio]:checked+label {
                color: #ff0000; /* Change the color when selected */
                font-weight: bold;
            }
        </style>';
    }
}

Output

The font size of the shipping method title has been increased and the color of the text in the WooCommerce cart page changes based on the selected radio button.

How to Customize Selected Shipping Method's Title in WooCommerce Cart? - Tyche Softwares

By default, the shipping method title on the WooCommerce cart page shows the default font size and text color.

How to Customize Selected Shipping Method's Title in WooCommerce Cart? - Tyche Softwares

Similarly, you can also customize the shipping method radio button styles in WooCommerce such as adding shadow or making the radio button size bigger.

Read Related Article: How To Disable Shipping Method If User Is Logged Out in WooCommerce?

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
3 Comments
Newest
Oldest
Inline Feedbacks
View all comments
22 days ago

Can you provide a Snippet so we are able to do this on the Checkout as well please?

Editor
21 days ago
Reply to  Andrew

Hi Andrew,

You can modify the if condition to also apply the styles on the checkout page like this: if (is_cart() || is_checkout()). Please refer to this screenshot for guidance. This adjustment will make the styling of shipping options automatically applied to both the cart and checkout pages.

21 days ago
Reply to  Saranya

Hi Saranya, that worked! Thank you so much! 🙂 -Andrew

3
0
Would love your thoughts, please comment.x
()
x