Skip to content

Commit

Permalink
Add filter to the update keys fucntion
Browse files Browse the repository at this point in the history
  • Loading branch information
kawsarahmedr committed Aug 15, 2024
1 parent a9e3f20 commit 0ee7b4d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,15 @@ function wcsn_order_update_keys( $order_id ) {
continue;
}

/**
* Filter hook to alter the keys before assigning them to the order item.
*
* @param Key[] $keys The keys.
* @param \WC_Order_Item $item Order item.
* @param \WC_Order $order Order object.
*/
$keys = apply_filters( 'wc_serial_numbers_order_item_keys', $keys, $item, $order );

// Assign keys to order.
foreach ( $keys as $key ) {
$key->set_data(
Expand Down

0 comments on commit 0ee7b4d

Please sign in to comment.