Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1280451
    SWH_Layout
    Participant

    I would like to share the code but it will not submit correctly. I’ll try again.

    add_action(‘woocommerce_after_add_to_cart_button’,’cmk_additional_button’);
    function cmk_additional_button() {$shop_page_url = get_permalink( woocommerce_get_page_id( ‘shop’ ) );
    echo ‘Change me please‘;
    }

    /Staffan

    #1280452
    SWH_Layout
    Participant

    How do I submit the code so the echo string is not deleted?

    /Staffan

    #1280561
    SWH_Layout
    Participant

    Hi again,

    Another question if it’s ok?
    I would like to add this button to the cart page, efter the apply coupon button and on the check out page efter the place order button in the bottom. How do I adjust the code so it finds these buttons?

    Thanks
    /Staffan

    Heres the code hope it submits correctly this time.

    add_action(‘woocommerce_after_add_to_cart_button’,’cmk_additional_button’);
    function cmk_additional_button() {$shop_page_url = get_permalink( woocommerce_get_page_id( ‘shop’ ) );
    echo ‘Return to shop‘;

    #1280569
    SWH_Layout
    Participant
    #1280715
    Rad
    Moderator

    Hi there,

    Please remove that, that adds another set of link within link.

    Thanks!

    #1281172
    SWH_Layout
    Participant

    Hi,
    I’m sorry I don’t quite understand what I’m supposed to remove.
    If you mean what I added in the code, it did’nt link to the shop until I added that.
    If there is some place in the updated code that, Christopher provided, where the shop URL should be added please advise because it only linked back to the same page.

    Thanks
    /Staffan

    #1281250
    Rue Nel
    Moderator

    Hello There,

    I made several modifications to the codes like this:

    add_filter( 'woocommerce_continue_shopping_redirect', 'change_return_shop_url', 50 );
    add_filter( 'woocommerce_return_to_shop_redirect', 'change_return_shop_url', 50 );
    
    function change_return_shop_url(){  
       return '#';
    }
    
    add_action('woocommerce_after_add_to_cart_button','cmk_additional_button', 50);
    function cmk_additional_button() {
      $shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );
      echo '<a href="'.$shop_page_url.'" class="button alt this is it">Fortsätt handla</a>';
    }

    Regretfully none of the changes did not reflect in your site. It could be that there are other settings or a conflict.
    You could try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

    #1281920
    SWH_Layout
    Participant
    This reply has been marked as private.
    #1282623
    Paul R
    Moderator

    Hi,

    You just need to change the hook(woocommerce_after_add_to_cart_button).

    You can add this in your child theme’s functions.php

    
    add_action( 'woocommerce_after_cart_table', 'woo_add_button_to_cart' );
    function woo_add_button_to_cart() {
       $shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );
      echo '<a href="'.$shop_page_url.'" class="button alt this is it">Fortsätt handla</a>';
    }
    
    add_action( 'woocommerce_after_checkout_form', 'woo_add_button_to_checkout' );
    function woo_add_button_to_checkout() {
       $shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );
      echo '<a href="'.$shop_page_url.'" class="button alt this is it">Fortsätt handla</a>';
    }
    
    

    You may refer ot the link below for your guide.

    https://docs.woocommerce.com/wc-apidocs/hook-docs.html

    Hope that helps.

    #1283535
    SWH_Layout
    Participant

    Hi,
    Gosh, we’re there. Just what I wanted. Many thanks. 🙂

    Just one, I promise, last question.
    If I want the two last buttons to show up after the other buttons and not below, what do I add to the code?

    Thanks again for your patience and help!

    /Staffan

    #1284071
    Lely
    Moderator

    Hello Staffan,

    Are you still referring to that cart page? Please do give us a screenshot on how the you want to button to display so we can give you exact recommendation.

    #1284084
    SWH_Layout
    Participant

    Hi,
    The cart and the checkout page now looks like Checkout 1.
    I would like them to look Checkout 2.

    Thanks
    /Staffan

    #1284206
    Christopher
    Moderator

    Hi there,

    What you’re trying to achieve could be possible with custom development but it would be outside the scope of our support.
    We could help you to add some margin to this button.

    Please add following code in Customize -> Custom -> Global CSS :

    a.button.alt.this.is.it {
        margin-top: 10px;
    }

    Hope it helps.

    #1284654
    SWH_Layout
    Participant

    Hi,
    I understand. Thanks for all your help. I has been much appreciated. You guys are doing a great job!

    /Staffan

    #1285063
    Rad
    Moderator

    You’re so much welcome!

  • <script> jQuery(function($){ $("#no-reply-1264310 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>