customerGroup example

string $customerGroup = 'customer-group',
        string $billingAddress = 'default-address',
        string $shippingAddress = 'default-address'
    ) {
        $this->ids = $ids;
        $this->id = $ids->create($customerNumber);
        $this->firstName = 'Max';
        $this->lastName = 'Mustermann';
        $this->email = 'max@mustermann.com';
        $this->salutation = self::salutation($ids);

        $this->customerGroup($customerGroup);
        $this->defaultBillingAddress($billingAddress);
        $this->defaultShippingAddress($shippingAddress);

        $this->defaultPaymentMethodId = self::connection()->fetchOne(
            'SELECT LOWER(HEX(payment_method_id)) FROM sales_channel_payment_method JOIN payment_method ON sales_channel_payment_method.payment_method_id = payment_method.id WHERE sales_channel_id = :id AND payment_method.active = true LIMIT 1',
            ['id' => Uuid::fromHexToBytes($salesChannelId)]
        );
    }

    
->defaultBillingAddress('address', [
                'id' => $addressId,
                'customerId' => $customerId,
                'countryId' => $this->getValidCountryId(),
                'salutationId' => $this->getValidSalutationId(),
                'firstName' => 'Max',
                'lastName' => 'Mustermann',
                'street' => 'Ebbinghoff 10',
                'zipcode' => '48624',
                'city' => 'Schöppingen',
            ])
            ->customerGroup(TestDefaults::FALLBACK_CUSTOMER_GROUP)
            ->build();

        $this->customerRepository->upsert([$customer]$this->context);

        return $customerId;
    }

    protected function createOrder(string $paymentMethodId): string
    {
        $orderId = $this->ids->get('order');
        $addressId = $this->ids->get('address');

        
Home | Imprint | This part of the site doesn't use cookies.