1

I've the following code:

$panes = commerce_checkout_panes();
$payment_pane = $panes['commerce_payment'];

which loads one of Commerce pane which contains the array like:

array (size=15)
  'title' => string 'Payment' (length=7)
  'page' => string 'review' (length=6)
  'file' => string 'includes/commerce_payment.checkout_pane.inc' (length=43)
  'base' => string 'commerce_payment_pane' (length=21)
...

How do I render that pane programmatically?

This is part of commerce_checkout_form_review form (which is normally present at /checkout/%/review), but I need to render only payment part (checkboxes) but in different place.

1 Answer 1

2

Panes are forms. Run them through drupal_get_form but you'll need to pass in some extra options:

require_once drupal_get_path('module', $payment_pane['module']) . '/' . $payment_pane['file'];
$order = commerce_order_load($order_id);
$payment_form = drupal_get_form($payment_pane['callbacks']['checkout_form'], $payment_pane, $order);
$output = drupal_render($payment_form);
1
  • 1
    This gets me all the pane elements but in raw format.. Any idea how I can get the themes results ?
    – mjs
    Oct 5, 2016 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.