Enabled product bundles

This commit is contained in:
Nedim Uka
2018-06-29 14:40:28 +02:00
parent e0514f7f57
commit b5475ff2f1
12004 changed files with 1694047 additions and 1610 deletions

View File

@@ -401,8 +401,18 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Products_Controller
// Update taxonomies.
if ( isset( $request['attributes'] ) ) {
$attributes = array();
$parent = wc_get_product( $variation->get_parent_id() );
$attributes = array();
$parent = wc_get_product( $variation->get_parent_id() );
if ( ! $parent ) {
return new WP_Error(
// Translators: %d parent ID.
"woocommerce_rest_{$this->post_type}_invalid_parent", sprintf( __( 'Cannot set attributes due to invalid parent product.', 'woocommerce' ), $variation->get_parent_id() ), array(
'status' => 404,
)
);
}
$parent_attributes = $parent->get_attributes();
foreach ( $request['attributes'] as $attribute ) {

View File

@@ -360,8 +360,6 @@ class WC_API_Orders extends WC_API_Resource {
public function create_order( $data ) {
global $wpdb;
wc_transaction_query( 'start' );
try {
if ( ! isset( $data['order'] ) ) {
throw new WC_API_Exception( 'woocommerce_api_missing_order_data', sprintf( __( 'No %1$s data specified to create %1$s', 'woocommerce' ), 'order' ), 400 );
@@ -466,15 +464,10 @@ class WC_API_Orders extends WC_API_Resource {
do_action( 'woocommerce_api_create_order', $order->get_id(), $data, $this );
do_action( 'woocommerce_new_order', $order->get_id() );
wc_transaction_query( 'commit' );
return $this->get_order( $order->get_id() );
} catch ( WC_Data_Exception $e ) {
wc_transaction_query( 'rollback' );
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => 400 ) );
} catch ( WC_API_Exception $e ) {
wc_transaction_query( 'rollback' );
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
}
}

View File

@@ -389,16 +389,12 @@ class WC_API_Orders extends WC_API_Resource {
* Create an order
*
* @since 2.2
*
* @param array $data raw order data
*
* @return array|WP_Error
*/
public function create_order( $data ) {
global $wpdb;
wc_transaction_query( 'start' );
try {
if ( ! isset( $data['order'] ) ) {
throw new WC_API_Exception( 'woocommerce_api_missing_order_data', sprintf( __( 'No %1$s data specified to create %1$s', 'woocommerce' ), 'order' ), 400 );
@@ -508,15 +504,10 @@ class WC_API_Orders extends WC_API_Resource {
do_action( 'woocommerce_api_create_order', $order->get_id(), $data, $this );
do_action( 'woocommerce_new_order', $order->get_id() );
wc_transaction_query( 'commit' );
return $this->get_order( $order->get_id() );
} catch ( WC_Data_Exception $e ) {
wc_transaction_query( 'rollback' );
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => 400 ) );
} catch ( WC_API_Exception $e ) {
wc_transaction_query( 'rollback' );
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
}
}