0

My extension_attribute.xml file below:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
   
    <extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="comment" type="string"/>
    </extension_attributes>
</config>

I have created field (text box) in payment page Magento 2 checkout.

i want to save this value to customer_note column in sales_order_grid

I followed this answer

https://magento.stackexchange.com/a/187848/73525

but not working for (Payment comment field save )

this plugin not working

etc/di.xml

 <type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="order_comments_save-in-order" type="Sugarcode\Deliverydate\Plugin\Checkout\PaymentInformationManagementPlugin" sortOrder="10"/>
    </type>

How can I save this attribute to orders and order grid?

4
0

If you are able to save that custom field data to sales_order table 'sat customer_note column then you can save also at sales_order_grid.

First, you have to create the column customer_note to sales_order_grid using declarative schema if using 2.3 or create a new column using install InstallSchema or upgrade scheme.

using Plugin on Magento\Sales\Model\ResourceModel\Grid save data to sales_order_grid table.

1
  • actually that plugin not working – prabhakaran7 Jan 21 '20 at 6:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.