Add Text Below the Payment Button in the Shopping Cart

Add custom text below the checkout button on the cart page.

PHP
/**
 * Snippet Name:     Add text below the payment button in the shopping cart
 * Snippet Author:   coding-bunny.com
 * Description:      Add custom text below the checkout button on the cart page.
 */
 
 /**
 * Add a trust symbol below WooCommerce cart totals
 */
function cb_woocommerce_after_cart_totals() {
    // Display a trust symbol with a lock icon and text
    echo '<div id="cb-cart-trust-symbols"><i class="fas fa-lock"></i> Shop securely</div>';
}
// Hook the function to the 'woocommerce_after_cart_totals' action
add_action('woocommerce_after_cart_totals', 'cb_woocommerce_after_cart_totals', 10);

/**
 * Add custom styles for the trust symbol on the cart page
 */
function cb_add_cart_trust_symbols_styles() {
    // Check if the current page is the WooCommerce cart page
    if (is_cart()) { ?>
        <style>
            #cb-cart-trust-symbols {
                color: green;
                font-size: 13px;
                padding-top: 10px;
                text-align: left;
            }
        </style>
    <?php }
}

// Hook the function to the 'wp_head' action to add styles to the head section
add_action('wp_head', 'cb_add_cart_trust_symbols_styles');

How To Implement This Solution?

Leave a Reply

Your email address will not be published. Required fields are marked *

My Agile Privacy
This site uses technical and profiling cookies. You can accept, decline or customize cookies by pressing the desired buttons. By closing this policy you will continue without accepting.

Need help?

Choose one of the following options:

Powered by CodingBunny