Warning: This method has been deprecated. Use duplicate_product() instead.
Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use duplicate_product instead.
WC_Admin_Duplicate_Product::get_product_to_duplicate( mixed $id )
Get a product from the database to duplicate.
Contents
Description Description
See also See also
Parameters Parameters
- $id
-
(Required) The ID of the product to duplicate.
Return Return
(object|bool)
Source Source
File: includes/admin/class-wc-admin-duplicate-product.php
private function get_product_to_duplicate( $id ) { global $wpdb; $id = absint( $id ); if ( ! $id ) { return false; } $post = $wpdb->get_row( $wpdb->prepare( "SELECT {$wpdb->posts}.* FROM {$wpdb->posts} WHERE ID = %d", $id ) ); if ( isset( $post->post_type ) && 'revision' === $post->post_type ) { $id = $post->post_parent; $post = $wpdb->get_row( $wpdb->prepare( "SELECT {$wpdb->posts}.* FROM {$wpdb->posts} WHERE ID = %d", $id ) ); } return $post; }
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |