7

Hi I'm wondering if there are any disadvantages when using persistent shopping cart in magento? If I do enable this are people forced to create an account and no longer check out as guests ? Thanks

11

@Marius while you would expect that to be logical in reality there is an edge case where the guest checkout option is disabled.

Replication

  • Logged in customer adds items to basket
  • Customer closes browsers
  • Website session times out kill var/session directory
  • Customer opens browser adds items to basket as guest.
  • Guest checkout it hidden.

Cause

An event called checkout_allow_guest is fired by Mage_Checkout_Helper_Data::isAllowedGuestCheckout()

This then observed by Mage_Persistent_Model_Observer::disableGuestCheckout() which disables the option to use guest checkout.

The cause of which is that the session is loaded by Mage_Persistent_Helper_Session::isPersistent() with the value of the persistence cookie:

    if (is_null($key)) {
        $key = Mage::getSingleton('core/cookie')->get(Mage_Persistent_Model_Session::COOKIE_NAME);
    }

Fix - Disabled event observer

You will need to create a new module with two files.

app/code/local/JZah/AllowPersistentGuestCheckout/etc/config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <JZah_AllowPersistentGuestCheckout>
            <version>0.1.0</version>
        </JZah_AllowPersistentGuestCheckout>
    </modules>
    <frontend>
        <events>
            <checkout_allow_guest>
                <observers>
                    <persistent>
                        <type>disabled</type>
                    </persistent>
                </observers>
            </checkout_allow_guest>
        </events>
    </frontend>
</config>

app/etc/modules/JZah_AllowPersistentGuestCheckout.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <JZah_AllowPersistentGuestCheckout>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Enterprise_Persistent/>
            </depends>
        </JZah_AllowPersistentGuestCheckout>
    </modules>
</config>

Created for Magento EE 1.14.1.0

6

I think you don't understand the concept of "persistent shopping cart" in Magento.
This has nothing to to with allowing guest checkout or not.
The only thing that it does, is to set a cookie that will allow the customer in his next visit to the website, using the same browser on the same device to view his shopping cart from his previous visit (and others, like wishlist compared products, ...) without the need to login.

Guest and logged in checkout works the same if the persistent shopping cart is enabled or disabled.

  • How to setup persistent shopping cart in magento 2? Any idea please share it. – Rakesh Jesadiya Aug 9 '16 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.