<?php
	
	use Automattic\WooCommerce\Blocks\Package;
	use Automattic\WooCommerce\StoreApi\Schemas\V1\CartSchema;
	use Automattic\WooCommerce\StoreApi\Schemas\V1\CheckoutSchema;
	
	
	class Korkmaz_Extend_Woo_Core
	{
		
		
		public function init()
		{
			$this->save_shipping_instructions();

		}
		
		private function save_shipping_instructions()
		{
			
			add_action(
				'woocommerce_store_api_checkout_update_order_from_request',
				function(\WC_Order $order, \WP_REST_Request $request) {
					$data = $request['extensions']['irem'];
					
					$billing_satis_sozlesme = $data['billing_satis_sozlesme'];
					$billing_mesafeli_sozlesme = $data['billing_mesafeli_sozlesme'];
					
					$order->update_meta_data('_billing_satis_sozlesme', $billing_satis_sozlesme);
					$order->update_meta_data('_billing_mesafeli_sozlesme', $billing_mesafeli_sozlesme);
					
					$order->save();
				},
				10,
				2
			);
		}

	}
