HELP! There Are No Items In Your Shopping Cart

I have created a product:

http://treethugger.com/store/products/chalk-dust-torture-charlie-brown/

You can add it to your cart.

The sidebar widget updates correctly.

Click on checkout takes you to the shopping cart page.

The page displays one lone line of text “There are no items in your cart.”

Ive searched the forum and read about 20 posts. Cant find anything. Please help!

  • Arun Basil Lal
    • New Recruit

    After a discussion with Aaron, it seems that changing the cart permalink wouldn’t (and shouldnt) have an effect on this.

    He said it should be a case with wrong COOKIEPATH defined in wp-config.php.

    Please check your wp-config.php and see if there is a COOKIEPATH defined. (just search for it). If so, remove it and see how we are doing.

    Let me know. Good luck!

  • Aaron
    • CTO

    Somewhere in your install it is being defined to /treehugger/. So the cart cookies are not readable on your domain.

    Not sure where that is being set though, very strange. Is the site domain mapped, or installed in a weird location like a subfolder or something?

    It could be a plugin setting this as well. I would first try adding this to wp-config:

    define( 'SITECOOKIEPATH', '/' );
    define( 'COOKIEPATH', '/' );

    If that doesn’t work I would search/grep the files in your install for COOKIEPATH or SITECOOKIEPATH to see if we can narrow down which plugin is doing it.

  • ryan_getz
    • Flash Drive

    According to a GREP search, I have “COOKIEPATH” in all of these files:

    comment.php

    default-constants.php

    marketpress.php.php

    ms-default-constants.php

    pluggable-deprecated.php

    pluggable.php

    woocommerce.php

    wp-config.php

    wp-login.php

    wp-pass.php

    What should I be looking for within these documents now?

  • ryan_getz
    • Flash Drive

    Here is comment.php

    function wp_set_comment_cookies($comment, $user) {
    if ( $user->exists() )
    return;

    $comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000);
    setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
    setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
    setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
    }

    Here is default-contants.php

    /**
    * @since 1.2.0
    */
    if ( !defined('COOKIEPATH') )
    define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );

    /**
    * @since 1.5.0
    */
    if ( !defined('SITECOOKIEPATH') )
    define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );

    /**
    * @since 2.6.0
    */
    if ( !defined('ADMIN_COOKIE_PATH') )
    define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );

    /**
    * @since 2.6.0
    */
    if ( !defined('PLUGINS_COOKIE_PATH') )
    define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) );

    Here is marketpress.php

    function wp_set_comment_cookies($comment, $user) {
    if ( $user->exists() )
    return;

    $comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000);
    setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
    setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
    setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
    }

  • ryan_getz
    • Flash Drive

    Here is the woocommerce.php (though since i am not using woo, i have since deleted this file from the server)

    function cart_has_contents_cookie( $set ) {
    if ( ! headers_sent() ) {
    if ($set)
    setcookie( "woocommerce_items_in_cart", "1", 0, COOKIEPATH, COOKIE_DOMAIN, false );
    else
    setcookie( "woocommerce_items_in_cart", "0", time() - 3600, COOKIEPATH, COOKIE_DOMAIN, false );
    }
    }

  • ryan_getz
    • Flash Drive

    what are your thoughts on the above lines of code?

    i think the conflict may be within the default-contants.php file, though honestly; i don’t fully know what i need to be looking for.

    please advise.

    thank you kindly.

    very excited to get this up and running.

  • Aaron
    • CTO

    Default constants would only be applied if you didn’t set those lines I told you in wp-config.

    This is super wierd.

    Is this multisite?

    Is the site domain mapped, or installed in a weird location like a subfolder or something?

    What do you have set in the db wp_options table for ‘home’ and ‘siteurl’ meta keys?

  • Gunleik
    • WPMU DEV Initiate

    Have the same issue where

    1. cart goes empty at checkout on most browsers except Chrome

    2. Last customers data is retained in the form, even when logging in from a different computer/location/browser.

    no cache plugins activated…

  • Jack Kitterhing
    • Code Norris

    Hi there @Gunleik

    I hope your well today and sorry to hear your also having the same problem.

    Can you tell me who your host is please, as if it’s someone like WPEngine, they run their own cache which could effect this.

    Can I have a link to your site please?

    Which version of Multisite are you using?

    Is this a sub domain or sub directory install?

    Please advise.

    Thanks!

    Kind Regards

    Jack

  • Klemens
    • Design Lord, Child of Thor

    Hello there,

    Unfortunately, I also have the same problem recently. Previously it worked well but since I changed the link structure of my cart page, my shopping cart is empty.

    When I Click on checkout it takes me to the shopping cart page.

    The page displays


    There are no items in your cart

    Please could you help me to fix it,

    best regards,

    Klemens

  • Vaughan
    • Support/SLS MockingJay

    Hi Klemens,

    As this thread is quite old, could you please start a new thread, as so much has changed in the last year or so since this thread was opened, and your site & setup will most likely be different to above, it will also help us to work on your issue better.

    Thanks

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.