0

I have two stores in my Magento site. I want to enable guest checkout for one store and the other store should not have guest checkout. How can I do this in Magento 1.8 ?

Any Help Appreciated.

2

Default configuration allows Magento to handle both registered users AND guests. To disable guests for another store go to System > Configuration > Sales > Checkout > Checkout Options. As you can see there's an option to disable or enable guests. Don't do anything yet. Please note that this options has "Store View" scope.

Now change store scope scope (upper left corner, Current Configuration Scope) and choose store you want guest checkout disable for. Page will reload and suddenly there's a checkbox with label Use Default. Uncheck this checkbox for you scope and change Allow Guest Checkout to No. Save.

Please note that the value is also inherited to all the children scopes. You can in turn override child values as well by unchecking their Use Default checkboxes as well.

  • Seems to be that this is only available on the website level and not on the store level – David Manners Jun 25 '14 at 18:25
  • Does it really matter? Since it's available on Store View level you can disable the functionality for all the views you have. Or you could create a new Website and assign your store there. – Pronto Jun 25 '14 at 18:44
  • Very true, you could create a new website with a single store in it. Just wanted to point out that it would not work if you have on the website level. Not 100% sure if they are asking about multiple store or view. – David Manners Jun 25 '14 at 18:47
  • Well, one can always disable guest checkout view by view. – Pronto Jun 25 '14 at 20:36
  • @Pronto you can easily enable this option for store view level. The getStoreConfig supports it. See my response above. – Dave Jun 27 '14 at 11:16
2

By default Magento only allows you to set your entire site to either allow or disallow guest checkout. This option is in System > Configuration > Sales > Checkout. This option for some reason is hidden on store view level even though the code below supports it. Luckily this is easy to change.

Within /app/code/core/Mage/Checkout/Helper/Data.php there is the isAllowedGuestCheckout() function.

/**
 * Check is allowed Guest Checkout
 * Use config settings and observer
 *
 * @param Mage_Sales_Model_Quote $quote
 * @param int|Mage_Core_Model_Store $store
 * @return bool
 */
public function isAllowedGuestCheckout(Mage_Sales_Model_Quote $quote, $store = null)
{
    if ($store === null) {
        $store = $quote->getStoreId();
    }
    $guestCheckout = Mage::getStoreConfigFlag(self::XML_PATH_GUEST_CHECKOUT, $store);

    if ($guestCheckout == true) {
        $result = new Varien_Object();
        $result->setIsAllowed($guestCheckout);
        Mage::dispatchEvent('checkout_allow_guest', array(
            'quote'  => $quote,
            'store'  => $store,
            'result' => $result
        ));

        $guestCheckout = $result->getIsAllowed();
    }

    return $guestCheckout;
}

You can see within this function that it is actually getting the configuration flag for the store.

    $guestCheckout = Mage::getStoreConfigFlag(self::XML_PATH_GUEST_CHECKOUT, $store);

So in theory if you open up app/code/core/Mage/Checkout/etc/system.xml and change the options to 1 for the various sections it should allow you to enable on a store level. The start of the file would look something like this:

Obviously you shouldn't modify this core file and instead place this in your own xml file!

<config>
    <sections>
        <checkout translate="label" module="checkout">
            <label>Checkout</label>
            <tab>sales</tab>
            <frontend_type>text</frontend_type>
            <sort_order>305</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <options translate="label">
                    <label>Checkout Options</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <onepage_checkout_enabled translate="label">
                            <label>Enable Onepage Checkout</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>5</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </onepage_checkout_enabled>
                        <guest_checkout translate="label">
                            <label>Allow Guest Checkout</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </guest_checkout>

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.