Handle PR feedback: Remove duplicate regular_price update, allow changing of post status for products, remove deprecation for get_title since we might still offer it as a function
This commit is contained in:
parent
fde97df50f
commit
6e69b0d924
|
@ -129,7 +129,6 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_title() {
|
public function get_title() {
|
||||||
_deprecated_function( 'WC_Product::get_title', '2.7', 'WC_Product::get_name' );
|
|
||||||
return apply_filters( 'woocommerce_product_title', $this->post ? $this->post->post_title : '', $this );
|
return apply_filters( 'woocommerce_product_title', $this->post ? $this->post->post_title : '', $this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
'slug' => '',
|
'slug' => '',
|
||||||
'date_created' => '',
|
'date_created' => '',
|
||||||
'date_modified' => '',
|
'date_modified' => '',
|
||||||
'status' => '',
|
'status' => 'publish',
|
||||||
'featured' => false,
|
'featured' => false,
|
||||||
'catalog_visibility' => 'hidden',
|
'catalog_visibility' => 'hidden',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
|
@ -988,7 +988,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
|
|
||||||
$id = wp_insert_post( apply_filters( 'woocommerce_new_product_data', array(
|
$id = wp_insert_post( apply_filters( 'woocommerce_new_product_data', array(
|
||||||
'post_type' => 'product',
|
'post_type' => 'product',
|
||||||
'post_status' => 'publish',
|
'post_status' => $this->get_status(),
|
||||||
'post_author' => get_current_user_id(),
|
'post_author' => get_current_user_id(),
|
||||||
'post_title' => $this->get_name(),
|
'post_title' => $this->get_name(),
|
||||||
'post_content' => $this->get_description(),
|
'post_content' => $this->get_description(),
|
||||||
|
@ -1021,6 +1021,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
'post_title' => $this->get_name(),
|
'post_title' => $this->get_name(),
|
||||||
'post_parent' => $this->get_parent_id(),
|
'post_parent' => $this->get_parent_id(),
|
||||||
'comment_status' => $this->get_reviews_allowed(),
|
'comment_status' => $this->get_reviews_allowed(),
|
||||||
|
'post_status' => $this->get_status(),
|
||||||
'menu_order' => $this->get_menu_order(),
|
'menu_order' => $this->get_menu_order(),
|
||||||
);
|
);
|
||||||
wp_update_post( $post_data );
|
wp_update_post( $post_data );
|
||||||
|
@ -1065,7 +1066,6 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
update_post_meta( $id, '_sku', $this->get_sku() );
|
update_post_meta( $id, '_sku', $this->get_sku() );
|
||||||
update_post_meta( $id, '_regular_price', $this->get_regular_price() );
|
update_post_meta( $id, '_regular_price', $this->get_regular_price() );
|
||||||
update_post_meta( $id, '_sale_price', $this->get_sale_price() );
|
update_post_meta( $id, '_sale_price', $this->get_sale_price() );
|
||||||
update_post_meta( $id, '_regular_price', $this->get_regular_price() );
|
|
||||||
update_post_meta( $id, '_sale_price_dates_from', $this->get_date_on_sale_from() );
|
update_post_meta( $id, '_sale_price_dates_from', $this->get_date_on_sale_from() );
|
||||||
update_post_meta( $id, '_sale_price_dates_to', $this->get_date_on_sale_to() );
|
update_post_meta( $id, '_sale_price_dates_to', $this->get_date_on_sale_to() );
|
||||||
update_post_meta( $id, 'total_sales', $this->get_total_sales() );
|
update_post_meta( $id, 'total_sales', $this->get_total_sales() );
|
||||||
|
|
Loading…
Reference in New Issue