Checkout Link on Mini-Cart needs “rel=nofollow” – crawler error generated

This topic has 4 replies, 2 voices, and was last updated 2 years, 2 months ago ago by bnourse

  • Avatar: bnourse
    bnourse
    Participant
    September 11, 2022 at 19:59

    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.

    Please, contact administrator
    for this information.
    3 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 12, 2022 at 15:03

    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

    Avatar: bnourse
    bnourse
    Participant
    September 13, 2022 at 00:09

    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

    Please contact administrator
    for this information.
    Avatar: bnourse
    bnourse
    Participant
    September 13, 2022 at 00:32

    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

  • Viewing 4 results - 1 through 4 (of 4 total)

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

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.