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
  • where you have add this field at checkout? Commented Jan 21, 2020 at 4:47
  • below payment selection Commented Jan 21, 2020 at 5:00
  • i want to save this value to customer_note column in sales_order_grid Commented Jan 21, 2020 at 5:02
  • I tried but the extension attribute not saved in table magento.stackexchange.com/questions/326902/… Commented Nov 25, 2020 at 5:26

1 Answer 1

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 Commented Jan 21, 2020 at 6:00

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.