cancel
Showing results for 
Search instead for 
Did you mean: 

Can Magento consistently add extension_attributes to the shipping-information request?

Can Magento consistently add extension_attributes to the shipping-information request?

Hello Mages,

 

We've developed a plugin which adds some extension_attributes to the shipping_address, however it seems on the first request of every new session, the extension_attributes is removed from the shipping-information request (during checkout) altogether.

 

The extension_attributes are set in JS via a subscription to the quote.shippingMethod method.

We've validated that the code runs, and that it runs when expected.

 

Here's some code from shipping-save-processor/default js:

 

  payload = {
                addressInformation: {
                    'shipping_address': quote.shippingAddress(),
                    'billing_address': quote.billingAddress(),
                    'shipping_method_code': quote.shippingMethod()['method_code'],
                    'shipping_carrier_code': quote.shippingMethod()['carrier_code']
                }
            };

            payloadExtender(payload);

            console.log(payload) // shipping_address.extensionAttributes exists here
            console.log(JSON.stringify(payload)) // but doesn't exist here.

I know that `payload` is lazy-evaluated, but how do I await the evaluation to prevent sending the shipping-information request until it has finished the evaluation?

 

We've now been two developers and hired a Magento Community expert for a week and none of us has been able to find the fix, any help would be greatly appreciated.

 

P.S. why it only happens on the first request, is beyond me.

 

Cheers,

 

5 REPLIES 5

Re: Can Magento consistently add extension_attributes to the shipping-information request?

Hi @jesper_jacobsen1,

I can help you in this query. But I need to know about one thing is what is the purpose of extension attributes? what type of extension is this? let me know those things.



If my information is useful, give kudos

Best regards
Madhuresan
Bootsgrid

Re: Can Magento consistently add extension_attributes to the shipping-information request?

Hi, @madhuresan_ramanan , The extension attributes holds an object of key-value pairs.

 

The pairs are:

shipping_rate_id: (integer) $id,

address_line: (string) $addressLine,

 

This is required for the functionality of the plugin to work as intended.

 

Cheers

Re: Can Magento consistently add extension_attributes to the shipping-information request?

Hi @jesper_jacobsen1,

Okay. I am not yet cleared  from your answer. Can you explain the full flow of the plugin which you have used. What is the flow of the plugin? How and where it will be works? Please explain general flow of the plugins. not much more technically. for solution I need to know the general purpose and functionality of the plugin not as technically.


If my information is useful, give kudos

Best regards
Madhuresan
Bootsgrid

Re: Can Magento consistently add extension_attributes to the shipping-information request?

Hi @madhuresan_ramanan 

 

Okay, the flow of a user is like this:

 

1) A user/guest adds an item to their shopping-cart.

2) The user/guest goes to the checkout page

3) The user/guest enters their checkout information on the page

4) When they pick a shipping-method, our plugin adds that shipping method to the extension_attributes, (or tries to anyways).

5) The user performs the checkout and sends the shipping-information request to the backend, allowing us to extract the extension_attributes.

 

Cheers

Re: Can Magento consistently add extension_attributes to the shipping-information request?

Hi @jesper_jacobsen1,


 I understand the flow of your plugin. I will try to fix this issue.Can we discuss over skype?Can you check your inbox?