WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Add to Cart functionality not working (9 posts)

  1. rudygfl
    Member
    Posted 1 year ago #

    I'm having an issue with the add-to-cart functionality within woocommerce and wanted to know if this is the default workflow or an issue. :-)

    On my install of woocommerce it seems like you must be an authenticated user (logged in) before you can add any product into the cart. Is this the way woocommerce is meant to work? If the user is not authenticated then these two things occur:

    1. If the user attempts to add-to-cart from the product archive page (product grid) a confirmation message appears under the product stating the the product was add to cart. When you navigate to the cart, the cart is empty.

    2. If the user attempts to add-to-cart from the product detail page no confirmation message appears... basically nothing seems to happen. If you navigate to the cart, the cart is empty.

    All does get resolved once you log into the website.

    Here's my particulars:

    WC Version: 2.0.5
    WC Database Version: 2.0.5
    Web Server Info: Apache
    PHP Version: 5.3.2-1ubuntu4.15
    WP Theme: Wootheme Simplicity 1.11.6
    Framework: Woo Framework 5.5.5

    Any thoughts? And thanks for your time in advance!

    Rudy

    http://wordpress.org/extend/plugins/woocommerce/

  2. rudygfl
    Member
    Posted 1 year ago #

    Another piece to the puzzle...

    When a un-authenticated user adds-to-cart from either product archive and product detail pages and then navigates to the cart page, the cart shows up empty. However, when the user then logs in, the original products that where added appear in the cart.

    Seems like the actual session was saved and then attached to the user once they authenticated.

    Thanks,

    Rudy

  3. azn137
    Member
    Posted 1 year ago #

    I ran into this bug the other day because I had DB Cache Reloaded Fix plugin installed. Once I removed it, everything was fine again.

  4. rudygfl
    Member
    Posted 1 year ago #

    Hi azn137:

    Thanks for your reply. At this time I only have Woocommerce plugged in. I've even removed the theme and went with the Twenty Twelve theme to make sure I've removed any potential conflicts or overrides.

    Does Woocommerce need you to first log in in order for the cart functionality to work properly? Not the checkout but just the ability to add a product to the cart.

    Thanks

  5. Roy Ho
    Member
    Posted 1 year ago #

    @rudygfl - no it doesn't require you to be logged in.

  6. rudygfl
    Member
    Posted 1 year ago #

    Hi splashingpixels:

    Thanks for your reply... Makes sense to me...

    Thanks

  7. phildom
    Member
    Posted 1 year ago #

    I had exactly the same issue and it is a caching issue. If you use a caching program make sure that cart and checkout are excluded, don't rely on woocommerce to exclude.

    If this fails, which it did for me, try adding this code (without the descriptors):

    Disabling Browser Cache in HTML
    With this code placed in the top of the head section you can turn off client side caching.

    <meta http-equiv="cache-control" content="max-age=0" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
    <meta http-equiv="pragma" content="no-cache" />

    Disabling Server Side Cache in PHP
    This little two liner code goes to the uppermost part of a PHP file.

    <?php
    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
    ?>

    This worked for even though perhaps it shouldn't of.

    You can check out the working site at https://www.creightonscakes.co.uk/2013

    edit: the ^&%^%$$ server seems to be having issues at the moment

  8. rudygfl
    Member
    Posted 1 year ago #

    Hi phildom:

    Awesome!

    I was leading down this path and had already sent an email to my hosting provider to have them work on this "potential" issue... no longer "potential" :-)

    For the sake of documentation, my hosting service provider is WPEngine. WPEngine uses a custom caching solution, which includes W3 Total Cache. When I matched that up with a post on the WooTheme knowledge base (http://support.woothemes.com/entries/22714772-Problem-adding-items-to-shopping-cart-cart-is-empty) I started leaning in that direction.

    With your post phildom I feel good about this solution. I'll implement the changes you posted and in addition report back my results once WPEngine support tweets their custom caching solution.

    Thanks for all your help!

    Rudy

  9. rudygfl
    Member
    Posted 1 year ago #

    Problem solved...

    phildon hit it right on the head... it issues were caused by a caching solution that my hosting provider uses. Once the exception rules were added all came well :-)

    In my case I didn't have to limit browser client side caching. The only thing that was needed was those exception rules being added. FYI I use WPEngine to host my websites. Here's an article they have posted that might help someone else:

    http://support.wpengine.com/wpengine-ecommerce/

    Thanks for all the input

    Rudy

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic