I want to insert / change a link on my checkout page, but am not sure how to change the code so it appears correctly. Hoping someone might be able to shed some light. I research & tried a number of things, but kept getting error pages. All I am trying to do is change the “Cart” link to be another link. But since the cart link isn’t formatted like a regular link, I’m not sure what to replace to get it to show properly. I want to just replace it with a regular URL (https://sprinly.com/subscription-plans).
Thanks in advance!!
add_action( 'woocommerce_checkout_before_order_review', 'my_wc_checkout_before_order_review', 10, 0 );
function my_wc_checkout_before_order_review() {
echo '<p class="return-to-cart">If you'd like to change your subscription, go back to <a href="'. WC()->cart->get_cart_url() .'">Cart</a>. </p>';
}
You need to replace the PHP that is generating the cart link (
WC()->cart->get_cart_url()
) with the URL, like so: