Skip to content

Commit

Permalink
Remove unused method from Products class
Browse files Browse the repository at this point in the history
  • Loading branch information
kawsarahmedr committed Dec 3, 2024
1 parent f4107ee commit 07e8e59
Showing 1 changed file with 0 additions and 94 deletions.
94 changes: 0 additions & 94 deletions includes/Admin/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,98 +244,4 @@ public static function product_save_data() {

do_action( 'wcsn_save_simple_product_meta', $post );
}


/**
* Display serial numbers in order item meta.
*
* @param int $o_item_id order item id.
* @param \WC_Order_Item $o_item order item object.
* @param \WC_Product $product product object.
*
* @since 1.1.6
*
* @return void
*/
public function order_itemmeta( $o_item_id, $o_item, $product ) {
global $post;
if ( ! is_object( $post ) || ! isset( $post->ID ) ) {
return;
}

$order = wc_get_order( $post->ID );

// bail for no order.
if ( ! $order ) {
return;
}

if ( 'completed' !== $order->get_status( 'edit' ) ) {
return;
}

// if this is not product then no need to process.
if ( empty( $product ) ) {
return;
}

if ( 'yes' !== get_post_meta( $product->get_id(), '_is_serial_number', true ) ) {
return;
}

$items = wcsn_get_keys(
array(
'order_id' => $post->ID,
'product_id' => $product->get_id(),
)
);

if ( empty( $items ) && $order ) {
echo wp_kses_post(
sprintf(
'<div class="wcsn-missing-serial-number">%s</div>',
__( 'Order missing serial numbers for this item.', 'wc-serial-numbers' )
)
);
return;
}

$url = admin_url( 'admin.php?page=wc-serial-numbers' );
printf(
'<br/><a href="%s">%s&rarr;</a>',
esc_url(
add_query_arg(
array(
'order_id' => $post->ID,
'product_id' => $product->get_id(),
),
$url
)
),
esc_html__( 'Serial Numbers', 'wc-serial-numbers' )
);

$url = admin_url( 'admin.php?page=wc-serial-numbers' );

$li = '';

foreach ( $items as $item ) {
$li .= sprintf(
'<li><a href="%s">&rarr;</a>&nbsp;%s</li>',
add_query_arg(
array(
'edit' => $item->id,
),
$url
),
wcsn_decrypt_key( $item->serial_key )
);
}
echo wp_kses_post(
sprintf(
'<ul>%s</ul>',
$li
)
);
}
}

0 comments on commit 07e8e59

Please sign in to comment.