Support » Plugin: WooCommerce » [Plugin: WooCommerce – excelling eCommerce] Add to Cart bug

Viewing 15 replies - 1 through 15 (of 28 total)
  • Plugin Author royho

    (@royho)

    Not sure what you mean? I am able to add items to cart with checkmark on all the pages you mentioned.

    I want it to go directly to the cart page after you click “Add to Cart”.

    Click the add to cart button. Then a checkmark appears. Then what? I don’t think my users will be smart enough to know what to do next. There is no action to get to the cart without searching somewhere on the page.

    Try it out on my page, in the section with products below: http://www.vellasella.com/

    Plugin Author royho

    (@royho)

    This function only works in the single product page currently and does not work in the grid view/product list view. However you may want to try this -> http://wcdocs.woothemes.com/snippets/set-a-custom-add-to-cart-url-to-redirect-to/

    Sounds like what I am looking for. But where do I add that code/snippet?

    Plugin Author royho

    (@royho)

    You can add it to your theme functions.php

    I added it there but it doesnt do anything

    add_filter('add_to_cart_redirect', 'custom_add_to_cart_redirect');
    
    function custom_add_to_cart_redirect() {
         return get_permalink(get_option('woocommerce_checkout_page_id')); // Replace with the url of your choosing
    }

    I guess I dont know where to replace with my url. I tried this:
    return http://www.vellasella.com/cart;

    Plugin Author royho

    (@royho)

    It should work if done correctly unless that example is also for single products page.

    But nonetheless there are also other ways to do it. For example in the add to cart JS file you can find a few callback triggers that you can use to redirect to checkout. If I recall it has a “added_to_cart” callback you can use.

    So in your theme JS file you can add something like this (untested)

    $("body").bind("added_to_cart", function() {
         window.location = "http://www.vellasella.com/cart";
    });
    

    That kind of worked, when I clicked add to cart, it seemed to add it because I got the checkmart. Then it redirected to the cart page and the cart was empty.

    I’m experiencing the add to cart bug as well. I have a simple product page with product images and an add to cart button. When you click add to cart- purple check mark appears but nothing is ever added to the cart and no notification that anything was added shows as well. Everything works fine on the single product page. Notice shows and view cart button displays after.

    Plugin Author royho

    (@royho)

    @chrisrabkin – not really sure what you mean by “bug”. The OP does not have a “bug” but they want a certain functionality where it redirects to the cart after add to cart in grid/list view.

    What is happening in both instances is that (while not logged in as anyone) the add to cart button is clicked and a purple checkmark displays indicating something is added to the cart. When you view the cart it contains zero products.

    I checked session variables and they are ok

    the single product page works and adds products to the cart just fine.

    here is the url for the products page.

    Shop

    Plugin Author royho

    (@royho)

    This would appear you have session issues on your site. Check with your hosting server to see if your session save path is set correctly and your site is able to write to it. This is not a WooCommerce “bug”.

    Yeah theres no session issues but i did untick the prepend shop under product base page and ticked taxonomy base prepend shop and items appear in the cart
    There is some issue as we checked with the techs that manage our servers and sessions are working fine for other sites with ecommerce only sites and wordpress session dependent processes. Sorry there’s a bug somewhere. I will report what I am finding on the Git.

    Just had the same

    My cart could not be found even though it had been added!

    Checked my settings and found…

    WooCommerce > Settings > Pages
    ——————————————————————-
    X Prepend product permalinks with shop base page (shop) Note: The shop page has children – child pages will not work if you enable this option.
    ——————————————————————-

    This was ticked!!! Unticked it and all is fine again!

    Plugin Author royho

    (@royho)

    Ok let’s back up a bit here. On a fresh install without changing anything, are you having this issue? This is what I was talking about when I said there is no bug.

    But nonetheless, try this. Put it back the way you had it when it wasn’t working, and then go to settings->permalinks and click on save twice and retest…

    For anyone reading this ….. Here’s what you need to do!!! (or at least it worked for me)…

    The first link given above has the answer … http://wcdocs.woothemes.com/snippets/set-a-custom-add-to-cart-url-to-redirect-to/

    add_filter('add_to_cart_redirect', 'custom_add_to_cart_redirect');
    
    function custom_add_to_cart_redirect() {
         return get_permalink(get_option('woocommerce_checkout_page_id')); // Replace with the url of your choosing
    }

    You just need to replace

    get_permalink(get_option('woocommerce_checkout_page_id'))

    with your cart page url…. something like

    http://www.myshop.com/cart/

    Sorted 🙂

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