field_name = $field_name; $this->meta_name = $meta_name; $this->shipment = $shipment; } /** * Handle checkout. * * @param array $fs_method Flexible Shipping method settings. * @param array $package WooCommerce package. */ public function handle_checkout( array $fs_method, array $package ) { if ( isset( $fs_method[ $this->field_name ] ) && '1' === $fs_method[ $this->field_name ] ) { $meta_value = 1; } else { $meta_value = 0; } $this->shipment->set_meta( $this->meta_name, $this->get_meta_filtered_value( $this->meta_name, $meta_value, $fs_method, $package, $this->shipment->get_order() ) ); } /** * Prepare matebox field values. * * @param array $values . * * @return array */ public function prepare_metabox_field_values( array $values ) { $values[ $this->field_name ] = $this->shipment->get_meta( $this->meta_name, '0' ); return $values; } /** * Save data from metabox. * * @param array $ajax_data . */ public function save_ajax_data( array $ajax_data ) { if ( isset( $ajax_data[ $this->field_name ] ) ) { $this->shipment->set_meta( $this->meta_name, sanitize_text_field( $ajax_data[ $this->field_name ] ) ); } else { $this->shipment->set_meta( $this->meta_name, '0' ); } } /** * . * * @param stdClass $shipment_data . * * @return stdClass * @throws WPDesk_Paczkomaty_ShipX_Exception . */ abstract public function modify_shipment_data( $shipment_data ); }