plugin updates
This commit is contained in:
@@ -626,7 +626,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
||||
*/
|
||||
public function set_status( $new_status ) {
|
||||
$old_status = $this->get_status();
|
||||
$new_status = 'wc-' === substr( $new_status, 0, 3 ) ? substr( $new_status, 3 ) : $new_status;
|
||||
$new_status = OrderUtil::remove_status_prefix( $new_status );
|
||||
|
||||
$status_exceptions = array( 'auto-draft', 'trash' );
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||
'description' => '',
|
||||
'short_description' => '',
|
||||
'sku' => '',
|
||||
'global_unique_id' => '',
|
||||
'price' => '',
|
||||
'regular_price' => '',
|
||||
'sale_price' => '',
|
||||
@@ -251,7 +252,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SKU (Stock-keeping unit) - product unique ID.
|
||||
* Get SKU (Stock-keeping unit).
|
||||
*
|
||||
* @param string $context What the value is for. Valid values are view and edit.
|
||||
* @return string
|
||||
@@ -260,6 +261,17 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||
return $this->get_prop( 'sku', $context );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Unique ID.
|
||||
*
|
||||
* @since 9.1.0
|
||||
* @param string $context What the value is for. Valid values are view and edit.
|
||||
* @return string
|
||||
*/
|
||||
public function get_global_unique_id( $context = 'view' ) {
|
||||
return $this->get_prop( 'global_unique_id', $context );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the product's active price.
|
||||
*
|
||||
@@ -835,6 +847,29 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||
$this->set_prop( 'sku', $sku );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set global_unique_id
|
||||
*
|
||||
* @since 9.1.0
|
||||
* @param string $global_unique_id Unique ID.
|
||||
*/
|
||||
public function set_global_unique_id( $global_unique_id ) {
|
||||
$global_unique_id = preg_replace( '/[^0-9\-]/', '', (string) $global_unique_id );
|
||||
if ( $this->get_object_read() && ! empty( $global_unique_id ) && ! wc_product_has_global_unique_id( $this->get_id(), $global_unique_id ) ) {
|
||||
$global_unique_id_found = wc_get_product_id_by_global_unique_id( $global_unique_id );
|
||||
|
||||
$this->error(
|
||||
'product_invalid_global_unique_id',
|
||||
__( 'Invalid or duplicated GTIN, UPC, EAN or ISBN.', 'woocommerce' ),
|
||||
400,
|
||||
array(
|
||||
'resource_id' => $global_unique_id_found,
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->set_prop( 'global_unique_id', $global_unique_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the product's active price.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user