Marketpress Cart issue when www is used

I’m having a slight issue with the shopping cart/checkout page. (store/shopping-cart)

When I access the page without the www and I have products in the cart, everything behaves correctly

When I acces this page with a www, and I have products in the cart, I get a message saying that the cart is empty.

I’ve changed the slugs to see if that was causing an issue, but no dice.

Can you guys shed some light on this one?

  • Arnold
    • El Macho WP

    A lot of the information about the cart is in cookies or session variables which are specific to the domain/subdomain they were created on. This is done for a lot of very god security reasons. So www and non www while they may end up at the same files are treated as if they were two different machines.

    This is built into the browser and you really don’t want to work around it.

    What you should do is decide whether you want to use the www or not ALL the time and setup your site to automatically redirect to the preferred version. This prevents your problem, is better for your SEO because your not splitting your backlinks between what Google sees as two different machines, and is all around best practice.

    How to do the redirect depends on your hosting. Some have the chouce built into cpanel when you make your addon domain, or you may need to do it in your .htaccess file. Google around for “www to non www” and you’ll find examples. For instance

  • aecnu
    • WP Unicorn

    Greetings GerardoRitchey,

    On a single install and having two different resolving WordPress URLs is not good at all and begging for continual problems.

    There should be no sub domains on a WordPress install without MultiSite.

    The easiest way to remedy this problem is to remove the www from your WordPress configuration file then when someone uses the www WordPress will change to without the www and things should work as expected.

    @arnoldb you are spot on with your comments regarding cookies etc. – rep points coming your way and thank you.

    Please let us know if this does not resolve your problem by reopening this ticket below marking it as not resolved (or else we’ll miss it!). In addition, please post any new symptoms or errors if applicable.

    Thank you both for being a WPMU Dev members!

    Cheers, Joe :slight_smile:

  • GerardoRitchey
    • Flash Drive

    I figured out the www on the wordpress install was the root of the issue and made the change before I posted here.

    The sad, part though, is that inevitably (and someone did) manually type the www url in. I guess that’s an edge case, and we’ll have to live with it.

    Thanks guys.

  • Timothy
    • Chief Pigeon

    Hey GerardoRitchey.

    If you speak with your host or whomever deals with your DNS and have them setup a Canonical Name so traffic to www goes to the domain root. That will fix the problem for you.

    Most DNS are set up like that these days. There shouldn’t really be a need for www.

    I’ve attached a screenshot of my DNS for my sandbox install as guidance.

    Take care.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.