Open sorinsinner opened 5 years ago
Did you ever resolve this issue?
I have just found a solution. You need to rename the "customAttributes" key from the JSON that will be sent to guest-rest-api, with "custom_attributes".
Here you can find the documentation: https://devdocs.magento.com/redoc/2.3/guest-rest-api.html#operation/checkoutGuestShippingInformationManagementV1SaveAddressInformationPost
Hey @IonutGorgos could you eloborate how does the issue is resolved? did you override core code
Hello,
I think that the solution wasn't to rename the "customAttributes" key. I did other things too. I will enumerate the steps.
<type name="Magento\Checkout\Model\GuestPaymentInformationManagement">
<plugin disabled="false" name="Experius_ExtraCheckoutAddressFields_Plugin_Magento_Checkout_Model_GuestPaymentInformationManagement"
sortOrder="10" type="Experius\ExtraCheckoutAddressFields\Plugin\Magento\Checkout\Model\GuestPaymentInformationManagement"/>
</type>
email
param in the beforeSavePaymentInformation method.beforeSavePaymentInformation method:
public function beforeSavePaymentInformation(
\Magento\Checkout\Model\GuestPaymentInformationManagement $subject,
$cartId,
$email,
PaymentInterface $paymentMethod,
AddressInterface $address
) {
$extAttributes = $address->getExtensionAttributes();
if (!empty($extAttributes)) {
$this->helper->transportFieldsFromExtensionAttributesToObject(
$extAttributes,
$address,
'extra_checkout_billing_address_fields'
);
}
}
"Property "0" does not have accessor method "get0" in class "Magento\Quote\Api\Data\AddressExtensionInterface"."
That is because you need to do some changes in view/frontend/web/js/action/set-shipping-information-mixin.jsWe need to have the extension_attributes key something like that:
{
attribute_code1_key: "attribute_code1_value",
attribute_code2_key: "attribute_code2_value",
....... ....... ....... ....... ....... ........
attribute_codeN_key: "attribute_codeN_value",
}
if (shippingAddress.customAttributes !== undefined) {
$.each(shippingAddress.customAttributes, function (key, value) {
var attrCode = value['attribute_code'];
var attrValue = value['value'];
shippingAddress['customAttributes'][attrCode] = value;
shippingAddress['extension_attributes'][attrCode] = attrValue;
});
}
Some changes in view/frontend/web/js/action/create-shipping-address-mixin.js:
if (messageContainer.custom_attributes != undefined) {
$.each(messageContainer.custom_attributes , function( key, value ) {
messageContainer['custom_attributes'][key] = value;
});
}
Some changes in view/frontend/web/js/action/set-billing-address-mixin.js:
if (billingAddress.customAttributes != undefined) {
$.each(billingAddress.customAttributes, function (key, value) {
var attrCode = value['attribute_code'];
var attrValue = value['value'];
billingAddress['extension_attributes'][attrCode] = attrValue;
});
}
Don't forget the fieldset.xml and extensions_attributes.xml files.
Hey @IonutGorgos Im still getting get0 exception while changing set-shipping-information-mixins could you share updated code and files please so that could everyone get cleared:
jyotishina94@gmail.com
Report ID: webapi-5d4c9c422969a; Message: Property "0" does not have accessor method "get0" in class "Magento\Quote\Api\Data\AddressExtensionInterface". {"exception":"[object] (Exception(code: 0): Report ID: webapi-5d4c9c422969a; Message: Property \"0\" does not have accessor method \"get0\" in class \"Magento\Quote\Api\Data\AddressExtensionInterface\". at /home/dev73onlinetesti/public_html/magento/project-community-edition/vendor/magento/framework/Webapi/ErrorProcessor.php:206, LogicException(code: 0): Property \"0\" does not have accessor method \"get0\" in class \"Magento\Quote\Api\Data\AddressExtensionInterface\". at /home/dev73onlinetesti/public_html/magento/project-community-edition/vendor/magento/framework/Reflection/NameFinder.php:100)"} []
@sorinsinner did you resolve issue?
Has anyone solved this problem?
yes its solved by your solution of files thanks.
On Fri, Aug 30, 2019 at 6:00 PM KovalskiWeb notifications@github.com wrote:
Has anyone solved this problem?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/experius/Magento-2-Module-Experius-ExtraCheckoutAddressFields/issues/11?email_source=notifications&email_token=AFZ56DQY7DA7XFTURXLVBFDQHERYTA5CNFSM4G5FAHS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5RXSMI#issuecomment-526612785, or mute the thread https://github.com/notifications/unsubscribe-auth/AFZ56DX2P2DUHPVQKP5LSILQHERYTANCNFSM4G5FAHSQ .
Is anyone has fix of this issue? Tried above solution but still getting same error.
hi,problem still remains any solution ?
I can't seem to get around this. Everything is working perfectly for logged in customer checkout (both frontend, and admin side).
But guest customer cannot place error with the following error coming up in the first step (Shipping) of checkout:
Can you help me figure this out? Checked on two different Magento 2.3 installations. One was fresh made just for testing this, and the other one is also 2.3 but with a theme applied.