Skip to main content
Add route match comment.
Source Link
imclean
  • 1.1k
  • 10
  • 18

I've created a custom checkout pane by extending Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase and added it to the "Order information" step in a checkout flow. This accepts customer data.

The customer then progresses to the "Review" stage to confirm everything is correct. The customer can "Edit" their information if required, going back to the "Order information" step.

Within the custom pane I'm wanting to determine whether it's being displayed in the "Order information" step or the "Review" step.

getStepId() always returns what's in the config for the pane. In this case, "Order information".

$this->order->checkout_step seems to always return "Review", or maybe it's just reporting the highest step reached in the order thus far.

Is there a Commerce native way of determining the exact step being viewed? Or will I need to check the URL directly?

Edit: I've tried checking the route name, but both /checkout/[id]/order_information and /checkout/[id]/review return commerce_checkout.form.

I've created a custom checkout pane by extending Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase and added it to the "Order information" step in a checkout flow. This accepts customer data.

The customer then progresses to the "Review" stage to confirm everything is correct. The customer can "Edit" their information if required, going back to the "Order information" step.

Within the custom pane I'm wanting to determine whether it's being displayed in the "Order information" step or the "Review" step.

getStepId() always returns what's in the config for the pane. In this case, "Order information".

$this->order->checkout_step seems to always return "Review", or maybe it's just reporting the highest step reached in the order thus far.

Is there a Commerce native way of determining the exact step being viewed? Or will I need to check the URL directly?

I've created a custom checkout pane by extending Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase and added it to the "Order information" step in a checkout flow. This accepts customer data.

The customer then progresses to the "Review" stage to confirm everything is correct. The customer can "Edit" their information if required, going back to the "Order information" step.

Within the custom pane I'm wanting to determine whether it's being displayed in the "Order information" step or the "Review" step.

getStepId() always returns what's in the config for the pane. In this case, "Order information".

$this->order->checkout_step seems to always return "Review", or maybe it's just reporting the highest step reached in the order thus far.

Is there a Commerce native way of determining the exact step being viewed? Or will I need to check the URL directly?

Edit: I've tried checking the route name, but both /checkout/[id]/order_information and /checkout/[id]/review return commerce_checkout.form.

Source Link
imclean
  • 1.1k
  • 10
  • 18

How can I accurately determine when a customer is on the "Review" step in Commerce?

I've created a custom checkout pane by extending Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase and added it to the "Order information" step in a checkout flow. This accepts customer data.

The customer then progresses to the "Review" stage to confirm everything is correct. The customer can "Edit" their information if required, going back to the "Order information" step.

Within the custom pane I'm wanting to determine whether it's being displayed in the "Order information" step or the "Review" step.

getStepId() always returns what's in the config for the pane. In this case, "Order information".

$this->order->checkout_step seems to always return "Review", or maybe it's just reporting the highest step reached in the order thus far.

Is there a Commerce native way of determining the exact step being viewed? Or will I need to check the URL directly?