Hi to all!
I am trying to create a payment plugin for ShopWare 6 and I am stuck when try to get the Shipping and the Billing address.
I know I am new in Shopware development, but few directions will be very helpful.
So, I am on the Checkout page and have access to the Cart and Shopware\Core\Framework\Context. From the Cart I can see the delivery address calling:
$this->cart->getDeliveries()->getAddresses();
but from this result I can not get the address details.
The second problem is I can not get the Billing address. Looks like it is not into the Cart. I tried to use the Customer object, but if the Customer has more than one address I always get the first one.
Thanks!
PS - OK from the delivery address I got the first one, then got the customer id and did what I guy suggested into StackOverflow:
$criteria = (new Criteria())
->addFilter(new EqualsFilter('id', $first_address->getCustomerId()))
->addAssociation('activeBillingAddress');
$customer_data = $this->customerRepository->search($criteria, $this->context);
but this is still not the active address. Into the admin my user has selected another address.