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:
Justin Shreve 2016-10-18 07:47:28 -07:00
parent fde97df50f
commit 6e69b0d924
2 changed files with 3 additions and 4 deletions

View File

@ -129,7 +129,6 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
* @return string
*/
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 );
}

View File

@ -31,7 +31,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
'slug' => '',
'date_created' => '',
'date_modified' => '',
'status' => '',
'status' => 'publish',
'featured' => false,
'catalog_visibility' => 'hidden',
'description' => '',
@ -988,7 +988,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
$id = wp_insert_post( apply_filters( 'woocommerce_new_product_data', array(
'post_type' => 'product',
'post_status' => 'publish',
'post_status' => $this->get_status(),
'post_author' => get_current_user_id(),
'post_title' => $this->get_name(),
'post_content' => $this->get_description(),
@ -1021,6 +1021,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
'post_title' => $this->get_name(),
'post_parent' => $this->get_parent_id(),
'comment_status' => $this->get_reviews_allowed(),
'post_status' => $this->get_status(),
'menu_order' => $this->get_menu_order(),
);
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, '_regular_price', $this->get_regular_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_to', $this->get_date_on_sale_to() );
update_post_meta( $id, 'total_sales', $this->get_total_sales() );