#StackBounty: #8 #commerce Creating commerce users programmatically

Bounty: 150

I need to import customer data from CSV files with billing and shipping data using Drupal 8.8 and Commerce 2.
I want to create the customer with its address data programmatically, but i do not know how to create billing and shipping.

I create the user as:

 $lang = Drupal::languageManager()->getCurrentLanguage()->getId();
 $user = DrupaluserEntityUser::create();
 $user->set("init", $email);
 $user->set("langcode", $lang);
 $user->set("preferred_langcode", $lang);
 $user->set("preferred_admin_langcode", $lang);
 // Save user account.

How do i create its billing and shipping data?

Get this bounty!!!

#StackBounty: #8 #commerce #payment-gateway Can a product support recurring and not recurring payment at the same time?

Bounty: 50

So if for some product variant I check option “Allow subscriptions” all product variants of that products can be bought only in recurring way? Is that true?

I mean, I can not have one product and one set of variations that can be purchased “normal” way (by paying whole price during checkout process) and other set of variations support subscriptions and recurring payment? Is that right?

If I want to support both ways of paying (recurring and “normal”) for one product I actually have to create 2 separate products? Correct?

Asking because when I edit product variation fields “Subsription type” and “Billing schedule” are both mandatory.

Get this bounty!!!

#StackBounty: #8 #commerce #payment-gateway Custom Commerce Payment Gateway – Order Information Form

Bounty: 100

I have followed the documentation at https://docs.drupalcommerce.org/commerce2/developer-guide/payments/create-payment-gateway/getting-started#step-3-create-a-payment-gateway-plugin

My CommercePaymentGateway shows up and is selectable when I get to the checkout order information step (checkout/2/order_information). However, I would like to add some fields to this to capture extra information.

From what I have seen it looks like I need the add-payment-method for the form key in the annotation and I need to extend the PaymentMethodAddForm to use the buildConfigurationForm method.


I can’t get custom form elements to show on the order information screen when using my custom CommercePaymentGateway.


If I move to OnsitePaymentGatewayBase (as suggested by @zaporylie) my form element does show. However, I don’t want all of the other fields(CC info and billing info) that come with it.

Here are the two files I have:



namespace Drupalach_paymentPluginCommercePaymentGateway;

use Drupalcommerce_paymentPluginCommercePaymentGatewayPaymentGatewayBase;

 * @CommercePaymentGateway(
 *   id = "ach_payment",
 *   label = @Translation("ACH"),
 *   display_label = @Translation("ACH"),
 *   forms = {
 *     "add-payment-method" = "Drupalach_paymentPluginFormACHPaymentMethodAddForm",
 *   },
 * )
class ACHPayment extends PaymentGatewayBase {



namespace Drupalach_paymentPluginForm;

use Drupalcommerce_paymentPluginFormPaymentMethodAddForm;
use DrupalCoreFormFormStateInterface;

class ACHPaymentMethodAddForm extends PaymentMethodAddForm {

  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form = parent::buildConfigurationForm($form, $form_state);

    $form['test_ach'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Test ACH'),

    return $form;

  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
    // TODO: Implement submitConfigurationForm() method.


Get this bounty!!!

#StackBounty: #8 #entities #commerce Allow some products to be sold only in bundles (groups) with some other products

Bounty: 50

I’m making commerce site with Drupal 8 and Drupal commerce and I have not so common request. Some of the products should be available to buy only in groups (bundles) with some other products. I.e. if you want to buy product A in quantity 100 you must also buy product B, product C and/or product D and sum of them (B+C+D) must also be 100. Other way it shouldn’t be possible to buy any of them separately.

I saw that there are some Bundle modules (not even sure if they could fulfill this request), but they exist only for Drupal 7.

So is there some module for D8 which will allow grouping products like this. If not what would be the best way to achieve this feature?

Get this bounty!!!