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
2 Answers
@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
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. Commented Aug 9, 2016 at 11:21