This topic has 4 replies, 2 voices, and was last updated 2 years, 3 months ago ago by bnourse
We are having problems with the checkout button link that is loaded with the mini-cart on every page. From the site user perspective, when the minicart is selected and the cart is empty, it properly displays the “No Products in Cart” and provides a link back to the shop. BUT… when the site is crawled, for example with SEMRush, the crawler tries to follow the checkout link, and an error is generated. See private content area for screenshots of problem and its source.
This would be properly resolved by adding a “rel=nofollow” to the checkout link on the minicart. Can this please be fixed??
Thank you for your support, we appreciate the theme.
Hello,
Please, use the next php snippet to modify the checkout button. This snippet you may add to your child-theme/functions.php https://prnt.sc/OlAgi_bb85IB
add_action('wp', function() {
remove_action( 'woocommerce_widget_shopping_cart_buttons', 'etheme_woocommerce_widget_shopping_cart_proceed_to_checkout', 20 );
add_action( 'woocommerce_widget_shopping_cart_buttons', 'etheme_child_woocommerce_widget_shopping_cart_proceed_to_checkout', 20 );
}, 70);
function etheme_child_woocommerce_widget_shopping_cart_proceed_to_checkout() {
echo '<a href="' . esc_url( wc_get_checkout_url() ) . '" class="button btn-checkout wc-forward" rel="nofollow">' . esc_html__( 'Checkout', 'xstore' ) . '</a>';
}
The results will be next -> https://prnt.sc/Yha0UNQK8QiR
Waiting for your feedback!
Regards
Hi Rose,
Thank you for your prompt response.
For some reason I am not able to add this snippet to my Child theme functions.php. Can you see why??
See private area.
Thanks,
Ben
Hello Again,
I have solved the problem by adding through the Snippets plugin, and it seems to work fine. So, no need for further attention on your part. Thanks again for your help with this!
Ben
The issue related to '‘Checkout Link on Mini-Cart needs “rel=nofollow” – crawler error generated’' has been successfully resolved, and the topic is now closed for further responses