Viewing 13 replies - 16 through 28 (of 28 total)
  • @hilmon
    Is there a way to do what you are suggesting but have the add to cart button change to display view cart when clicked?

    I thought you wanted the page to re-direct to the cart page once the “add to cart” button was clicked… If that’s the case then then the button is no longer visible… as you are on another page… no??

    Plugin Contributor royho

    (@royho)

    @chrisrabkin – then simply change the filter to woocommerce_cart_page_id

    add_filter('add_to_cart_redirect', 'custom_add_to_cart_redirect');
    
    function custom_add_to_cart_redirect() {
         return get_permalink(get_option('woocommerce_cart_page_id'));
    }
    
    Thread Starter vellasella

    (@vellasella)

    I tried replacing get_permalink(get_option(‘woocommerce_checkout_page_id’)) to https://www.vellasella.com/shop/

    but I get this error:

    Parse error: syntax error, unexpected ‘:’ in /home/vsadmin/public_html/wp-content/themes/bellissima/functions.php on line 730

    I tried using https://www.vellasella.com/shop/ but no redirect happened.

    Plugin Contributor royho

    (@royho)

    @vellasella – that’s because you probably forgot to enclose it with quotes… It should look like:

    return 'https://www.vellasella.com/shop/';
    
    Thread Starter vellasella

    (@vellasella)

    I have it like this:

    add_filter('add_to_cart_redirect', 'custom_add_to_cart_redirect');
    
    function custom_add_to_cart_redirect() {
         return 'https://www.vellasella.com/cart/';
    }

    But still it doesn’t redirect to the cart page. It stays on the page and just give me a button that says added and a check mark.

    I’ve just tested it … it does work….

    The redirect only works on the “add to cart” button on single product pages … not the buttons on your catalogue pages… why would you want it to redirect on those buttons??…

    Click add to cart on this page https://www.vellasella.com/shop/baby-kids/baby-car-seat-blanket/
    …. and you are taken to the cart page…

    Thread Starter vellasella

    (@vellasella)

    That has always worked for me on that page. I want them to be directed to the cart as soon as they add something from the home page or catalouge page.

    This is how many popular online line stores work, you want to drive them to make a purchase as quick as possible. On the cart page I have upsells and additional items, along with a continue shopping button.

    By just placing a check mark or changing the button to say “Added” there is no real action for the customer. And if they want to check out at that point, how can they??? If you click the checkmark it does nothing, same thing for the button. They need to search for the cart link which can be frustrating for a first time customer.

    So the most intuitive thing to drive sales is to either have it go directly to the cart or have something that post back next to the checkmark, like “View Cart”.

    Make Sense??

    Yes I do indeed … but I’m afraid I don’t have the answer to your question then … sorry …. I would guess that there might be another filter you could hook into. Have you checked out all the available hooks here? https://wcdocs.woothemes.com/codex/extending/hooks/. Its a real shame the WooCommerce forum has been taken down from their site…. I’m lost without it!!!

    Good luck … hope you figure it out ??

    neo1976

    (@neo1976)

    Hi, I had the same issue and I fixed it out.

    Just edit the /wp-content/plugins/woocommerce/templates/loop/add-to-cart.php

    Replace the code line:
    printf('<a href="%s" rel="nofollow" data-product_id="%s" class="add_to_cart_button button product_type_%s">%s</a>', $link, $product->id, $product->product_type, $label);

    For this code:
    printf('<a href="%s" rel="nofollow" data-product_id="%s" class="single_add_to_cart_button button alt">%s</a>', $link, $product->id, $label);

    And… voilá!

    Chris Lema

    (@chrislema)

    I’m also using woo commerce and I would like to change the add to cart button to a pay now button and set it so that when it is pressed it takes the customer directly to the checkout page.

    I have tried the above (changing code in addtocart.php and it keeps showing the product page with the add to cart button. Is there any way to avoid this step. I need to show a “buy now” button on my page then the button has to go directly to the shopping cart.
    How could I do this? Please help!

Viewing 13 replies - 16 through 28 (of 28 total)
  • The topic ‘[Plugin: WooCommerce – excelling eCommerce] Add to Cart bug’ is closed to new replies.