0

I have created the custom checkout flow plugin in drupal 8. And added the required steps in it as per the the commerce2 documentation. See the code below.

<?php

namespace Drupal\commerce_custom\Plugin\Commerce\CheckoutFlow;

use Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * @CommerceCheckoutFlow(
 *  id = "custom_checkout_flow",
 *  label = @Translation("Custom checkout flow"),
 * )
 */
class CustomCheckoutFlow extends CheckoutFlowWithPanesBase {



    public function getSteps() {

        return  [
            'order_information' => [
                'label' => $this->t('Order information'),
                'has_sidebar' => TRUE,
                'previous_label' => $this->t('Go back'),
            ],
            'shipping_options' => [
                'label' => $this->t('Shipping Methods'),
                'has_sidebar' => TRUE,
                'previous_label' => $this->t('Go back')
            ],
            'review' => [
                'label' => $this->t('Review'),
                'next_label' => $this->t('Continue to review'),
                'previous_label' => $this->t('Go back'),
                'has_sidebar' => TRUE,
            ],
        ] + parent::getSteps();
    }

}

And enable the checkout flow and applied it in the commerce order configurations. Even I am able to open the edit checkout flow page but when I am setting an view to the order information pane. I am getting the response code 500.

And the error I got is:

PHP Fatal error:  Drupal\\commerce_checkout\\Plugin\\Commerce\\CheckoutPane\\CheckoutPaneBase::defaultConfiguration(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;Drupal\\commerce_custom\\Plugin\\Commerce\\CheckoutFlow\\CustomCheckoutFlow&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in /var/www/html/labeloutlet_web/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutPane/CheckoutPaneBase.php on line 106, referer: http://localhost/labeloutlet_web/web/admin/commerce/config/checkout-flows/manage/custom_checkout_flow?destination=/labeloutlet_web/web/admin/commerce/config/checkout-flows

So my question is how to resolve this error and being able th change the configurations of the pane inside a custom checkout flow plugin.

Your Answer

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

Browse other questions tagged or ask your own question.