Skip to content

One Page Checkout won’t go to the second step in Magento 1.9.x

I moved my client’s old magento website from one server to another but now the one-page checkout won’t work.

I’m getting the following error when I press “continue” in the “Billing Section”

Warning: preg_match() expects parameter 2 to be string, array given in ../magento/public_html/index.php on line 34
{"goto_section":"shipping_method","update_section":{"name":"shipping-method","html":"
n
United States Postal Service</dt>n
n
n
n 
"usps_Priority
</span>n Priority Mail $19.71</span> </label>n </li>n </ul>n </dd>n </dl>n

The code is using: ../magento/public_html/app/code/core/Mage/Checkout/controllers/OnepageController.php

 public function saveBillingAction()
    {
        if ($this->_expireAjax()) {
            return;
        }

        if ($this->isFormkeyValidationOnCheckoutEnabled() && !$this->_validateFormKey()) {
            return;
        }

        if ($this->getRequest()->isPost()) {
            $data = $this->getRequest()->getPost('billing', array());
            $customerAddressId = $this->getRequest()->getPost('billing_address_id', false);

            if (isset($data['email'])) {
                $data['email'] = trim($data['email']);
            }
            $result = $this->getOnepage()->saveBilling($data, $customerAddressId);
            
            if (!isset($result['error'])) {
                if ($this->getOnepage()->getQuote()->isVirtual()) {
                    $result['goto_section'] = 'payment';
                    $result['update_section'] = array(
                        'name' => 'payment-method',
                        'html' => $this->_getPaymentMethodsHtml()
                    );
                } elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
                    $result['goto_section'] = 'shipping_method';
                    $result['update_section'] = array(
                        'name' => 'shipping-method',
                        'html' => $this->_getShippingMethodsHtml()
                    );

                    $result['allow_sections'] = array('shipping');
                    $result['duplicateBillingInfo'] = 'true';
                } else {
                    $result['goto_section'] = 'shipping';
                }
            }
            


            $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
        }
    }

Does anyone have any idea what can be the issue?