magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.5k stars 9.31k forks source link

Custom shipping attributes not passed through for shipping estimates. #19578

Closed LiamKarlMitchell closed 5 years ago

LiamKarlMitchell commented 5 years ago

Summary (*)

I am trying to use extra attributes added to the shipping address during shipping rate estimate calculations and to decide the availability of shipping methods. (Via a module called owebia magento2 module advanced shipping setting)

I can see the attributes present on the shipping address but they are always NULL. owebia/magento2-module-advanced-shipping-setting#46

Examples (*)

https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Quote/Model/Quote/Address.php#L984

Proposed solution

I suspect the extra attributes need to actually be set on the RateRequest. https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Quote/Model/Quote/Address/RateRequest.php

Possibly related to #15026

magento-engcom-team commented 5 years ago

Hi @LiamKarlMitchell. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me $VERSION instance

where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop). For more details, please, review the Magento Contributor Assistant documentation.

@LiamKarlMitchell do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

magento-engcom-team commented 5 years ago

Hi @engcom-backlog-nazar. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

ghost commented 5 years ago

hi @LiamKarlMitchell I can see the attributes present on the shipping address but they are always NULL. Where you set your extension attributes ? please describe more information.

ghost commented 5 years ago

@LiamKarlMitchell 1.Run $ bin/magento setup:di:compile to generate ShippingMethodExtensionInterface and a class that implements this (this is not done on each request even with disabled cache)

2.In your plugin instantiate Magento\Quote\Api\Data\ShippingMethodExtension and add data to that object and then the entire object add to the entity with $entity->setExtensionAttributes($extensionModel)

ghost commented 5 years ago

@LiamKarlMitchell -> https://devdocs.magento.com/guides/v2.0/extension-dev-guide/extension_attributes/adding-attributes.html

LiamKarlMitchell commented 5 years ago

Thanks for the advice I'll give it a go.

On Thu, 6 Dec 2018, 1:45 AM engcom-backlog-nazar <notifications@github.com wrote:

Closed #19578 https://github.com/magento/magento2/issues/19578.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/magento/magento2/issues/19578#event-2007002857, or mute the thread https://github.com/notifications/unsubscribe-auth/AB4H7ekTOobfGwAlvhb1XmU2wZIdhfD0ks5u17_NgaJpZM4ZCnuz .

evs-xsarus commented 5 years ago

@liam-wiltshire I have the same issue, did you solve this and can you provide example code?

LiamKarlMitchell commented 4 years ago

Hey @evs-xsarus , Yes I stopped using Owebia and ended up writing my own shipping/carrier module with the custom logic for the customer(s) as needed...

For example: Free shipping within X distance of their stores. Shipping via heavier/larger items via Truck, removing other shipping options if too large/heavy to go in them.

hansoncitra commented 4 years ago

Hi @LiamKarlMitchell can you please tell us how you solved this issue? I have the exactly same issue, I want to get custom attributes from address, but cant get it on rateRequest variable. Thank you in advance.