plugin updates

This commit is contained in:
Tony Volpe
2024-09-05 11:04:01 -04:00
parent ed6b060261
commit 50cd64dd3d
925 changed files with 16918 additions and 13003 deletions

View File

@@ -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.
*