plugin updates
This commit is contained in:
@@ -586,7 +586,7 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller {
|
||||
),
|
||||
'rate_id' => array(
|
||||
'description' => __( 'Tax rate ID.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'type' => 'integer',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
|
||||
@@ -930,6 +930,11 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller {
|
||||
$this->maybe_set_item_props( $item, array( 'name', 'quantity', 'total', 'subtotal', 'tax_class' ), $posted );
|
||||
$this->maybe_set_item_meta_data( $item, $posted );
|
||||
|
||||
if ( 'update' === $action ) {
|
||||
require_once WC_ABSPATH . 'includes/admin/wc-admin-functions.php';
|
||||
wc_maybe_adjust_line_item_product_stock( $item );
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
@@ -1619,7 +1624,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller {
|
||||
),
|
||||
'rate_id' => array(
|
||||
'description' => __( 'Tax rate ID.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'type' => 'integer',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
|
||||
@@ -462,8 +462,12 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller {
|
||||
protected function get_attribute_taxonomy_name( $slug, $product ) {
|
||||
// Format slug so it matches attributes of the product.
|
||||
$slug = wc_attribute_taxonomy_slug( $slug );
|
||||
$attributes = $product->get_attributes();
|
||||
$attribute = false;
|
||||
$attributes = array_combine(
|
||||
array_map( 'wc_sanitize_taxonomy_name', array_keys( $product->get_attributes() ) ),
|
||||
array_values( $product->get_attributes() )
|
||||
);
|
||||
|
||||
$attribute = false;
|
||||
|
||||
// pa_ attributes.
|
||||
if ( isset( $attributes[ wc_attribute_taxonomy_name( $slug ) ] ) ) {
|
||||
@@ -1904,7 +1908,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller {
|
||||
),
|
||||
'stock_quantity' => array(
|
||||
'description' => __( 'Stock quantity.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'type' => has_filter( 'woocommerce_stock_amount', 'intval' ) ? 'integer' : 'number',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
),
|
||||
'in_stock' => array(
|
||||
|
||||
@@ -231,13 +231,16 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires after a product review is deleted via the REST API.
|
||||
* Fires after a shipping zone is deleted via the REST API.
|
||||
*
|
||||
* @param object $method
|
||||
* @param WP_REST_Response $response The response data.
|
||||
* @param WP_REST_Request $request The request sent to the API.
|
||||
* @since 9.1.0
|
||||
*
|
||||
* @param WC_Shipping_Method $method The shipping zone method being deleted.
|
||||
* @param WC_Shipping_Zone $zone The shipping zone the method belonged to.
|
||||
* @param WP_REST_Response $response The response data.
|
||||
* @param WP_REST_Request $request The request sent to the API.
|
||||
*/
|
||||
do_action( 'rest_delete_product_review', $method, $response, $request );
|
||||
do_action( 'woocommerce_rest_delete_shipping_zone_method', $method, $zone, $response, $request );
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -1407,36 +1407,39 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
|
||||
$shortcode_required = false;
|
||||
$block_present = false;
|
||||
$block_required = false;
|
||||
$page = false;
|
||||
|
||||
// Page checks.
|
||||
if ( $page_id ) {
|
||||
$page_set = true;
|
||||
}
|
||||
if ( get_post( $page_id ) ) {
|
||||
$page_exists = true;
|
||||
}
|
||||
if ( 'publish' === get_post_status( $page_id ) ) {
|
||||
$page_visible = true;
|
||||
$page = get_post( $page_id );
|
||||
|
||||
if ( $page ) {
|
||||
$page_exists = true;
|
||||
|
||||
if ( 'publish' === $page->post_status ) {
|
||||
$page_visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Shortcode checks.
|
||||
if ( $values['shortcode'] && get_post( $page_id ) ) {
|
||||
if ( $values['shortcode'] && $page ) {
|
||||
$shortcode_required = true;
|
||||
$page = get_post( $page_id );
|
||||
if ( strstr( $page->post_content, $values['shortcode'] ) ) {
|
||||
if ( has_shortcode( $page->post_content, trim( $values['shortcode'], '[]' ) ) ) {
|
||||
$shortcode_present = true;
|
||||
}
|
||||
|
||||
// Compatibility with the classic shortcode block which can be used instead of shortcodes.
|
||||
if ( ! $shortcode_present && ( 'woocommerce/checkout' === $values['block'] || 'woocommerce/cart' === $values['block'] ) ) {
|
||||
$shortcode_present = has_block( 'woocommerce/classic-shortcode', $page->post_content );
|
||||
}
|
||||
}
|
||||
|
||||
// Block checks.
|
||||
if ( $values['block'] && get_post( $page_id ) ) {
|
||||
if ( $values['block'] && $page ) {
|
||||
$block_required = true;
|
||||
$block_present = WC_Blocks_Utils::has_block_in_page( $page_id, $values['block'] );
|
||||
|
||||
// Compatibility with the classic shortcode block which can be used instead of shortcodes.
|
||||
if ( ! $block_present && ( 'woocommerce/checkout' === $values['block'] || 'woocommerce/cart' === $values['block'] ) ) {
|
||||
$block_present = WC_Blocks_Utils::has_block_in_page( $page_id, 'woocommerce/classic-shortcode', true );
|
||||
}
|
||||
$block_present = has_block( $values['block'], $page->post_content );
|
||||
}
|
||||
|
||||
// Wrap up our findings into an output array.
|
||||
|
||||
Reference in New Issue
Block a user