Change create to save

This commit is contained in:
Claudiu Lodromanean 2017-03-02 14:28:35 -08:00
parent c76c2d1a8d
commit bd4458fa90
3 changed files with 8 additions and 4 deletions

View File

@ -264,7 +264,7 @@ class WC_API_Products extends WC_API_Resource {
$product->set_description( isset( $data['description'] ) ? $post_content : '' );
// Attempts to create the new product.
$product->create();
$product->save();
$id = $product->get_id();
// Checks for an error in the product creation
@ -1498,7 +1498,7 @@ class WC_API_Products extends WC_API_Resource {
*/
private function save_downloadable_files( $product, $downloads, $deprecated = 0 ) {
if ( $deprecated ) {
wc_deprecated_argument( 'variation_id', '2.7', 'save_downloadable_files() not requires a variation_id anymore.' );
wc_deprecated_argument( 'variation_id', '2.7', 'save_downloadable_files() does not require a variation_id anymore.' );
}
$files = array();

View File

@ -983,6 +983,10 @@ class WC_API_Orders extends WC_API_Resource {
}
$item_id = $line_item->save();
if ( ! $item_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_create_line_item', __( 'Cannot create line item, try again.', 'woocommerce' ), 500 );
}
}
/**

View File

@ -318,7 +318,7 @@ class WC_API_Products extends WC_API_Resource {
}
// Attempts to create the new product.
$product->create();
$product->save();
$id = $product->get_id();
// Checks for an error in the product creation.
@ -1997,7 +1997,7 @@ class WC_API_Products extends WC_API_Resource {
*/
private function save_downloadable_files( $product, $downloads, $deprecated = 0 ) {
if ( $deprecated ) {
wc_deprecated_argument( 'variation_id', '2.7', 'save_downloadable_files() not requires a variation_id anymore.' );
wc_deprecated_argument( 'variation_id', '2.7', 'save_downloadable_files() does not require a variation_id anymore.' );
}
$files = array();