2

I am newish to Drupal and have been trying to print out the billing address data from the saved payment method information labels in drupal commerce checkout. The payment processor is Auth.net, using Drupal 8.6.14 and Commerce 8.x-2.13. I have tried getting $billing_profile to show with no luck.

$pane_form['payment_method'] = [
      '#type' => 'radios',
      '#title' => $this->t('Payment method'),
      '#markup' => '<p>Please choose from a previously saved credit card or pay with a new card.</p>',
      '#options' => $billing_profile,
      '#default_value' => $default_option->getId(),
      '#ajax' => [
        'callback' => [get_class($this), 'ajaxRefresh'],
        'wrapper' => $pane_form['#wrapper_id'],
      ],
      '#access' => count($options) > 1,
    ];

    // Add a class to each individual radio, to help themers.
    foreach ($options as $option) {
      $class_name = $option->getPaymentMethodId() ? 'stored' : 'new';
      $pane_form['payment_method'][$option->getId()]['#attributes']['class'][] = "payment-method--$class_name";
      $store = $this->order->getStore();
      $billing_profile = $this->order->getBillingProfile();
      if (!$billing_profile) {
        $billing_profile = $this->entityTypeManager->getStorage('profile')->create([
          'uid' => $this->order->getCustomerId(),
          'type' => 'customer',
        ]);
      }


    }
1
  • Welcome to Drupal Answers! Can you please post your code? Thanks :) – user72672 Nov 26 '19 at 13:56

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.