Automattic\WooCommerce\Admin\Features\Fulfillments
FulfillmentOrderNotes::add_fulfillment_deleted_note
Add an order note when a fulfillment is deleted.
Method of the class: FulfillmentOrderNotes{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$FulfillmentOrderNotes = new FulfillmentOrderNotes(); $FulfillmentOrderNotes->add_fulfillment_deleted_note( $fulfillment ): void;
- $fulfillment(Fulfillment) (required)
- The fulfillment object.
FulfillmentOrderNotes::add_fulfillment_deleted_note() FulfillmentOrderNotes::add fulfillment deleted note code WC 10.7.0
public function add_fulfillment_deleted_note( Fulfillment $fulfillment ): void {
$order = $fulfillment->get_order();
if ( ! $order instanceof \WC_Order ) {
return;
}
$message = sprintf(
/* translators: %d: fulfillment ID */
__( 'Fulfillment #%d deleted.', 'woocommerce' ),
$fulfillment->get_id()
);
/**
* Filters the order note message when a fulfillment is deleted.
*
* Return null to cancel the note.
*
* @since 10.7.0
*
* @param string|null $message The note message.
* @param Fulfillment $fulfillment The fulfillment object.
* @param \WC_Order $order The order object.
*/
$message = apply_filters( 'woocommerce_fulfillment_deleted_order_note', $message, $fulfillment, $order );
$message = $this->normalize_note_message( $message );
if ( null === $message ) {
return;
}
$order->add_order_note( $message, 0, false, array( 'note_group' => OrderNoteGroup::FULFILLMENT ) );
}