Fixed import and visibility tax values to lowercase (#33820)
* Fixed import and visibility tax values to lowercase * Minor fixes --------- Co-authored-by: Jorge A. Torres <jorge.torres@automattic.com>
This commit is contained in:
parent
bf77b4c022
commit
0780386610
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: enhancement
|
||||||
|
|
||||||
|
Fixed visibility and tax values convert to lowercase as issue facing in importing.
|
|
@ -781,7 +781,9 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
* @param string $visibility Options: 'hidden', 'visible', 'search' and 'catalog'.
|
* @param string $visibility Options: 'hidden', 'visible', 'search' and 'catalog'.
|
||||||
*/
|
*/
|
||||||
public function set_catalog_visibility( $visibility ) {
|
public function set_catalog_visibility( $visibility ) {
|
||||||
$options = array_keys( wc_get_product_visibility_options() );
|
$options = array_keys( wc_get_product_visibility_options() );
|
||||||
|
$visibility = in_array( $visibility, $options, true ) ? $visibility : strtolower( $visibility );
|
||||||
|
|
||||||
if ( ! in_array( $visibility, $options, true ) ) {
|
if ( ! in_array( $visibility, $options, true ) ) {
|
||||||
$this->error( 'product_invalid_catalog_visibility', __( 'Invalid catalog visibility option.', 'woocommerce' ) );
|
$this->error( 'product_invalid_catalog_visibility', __( 'Invalid catalog visibility option.', 'woocommerce' ) );
|
||||||
}
|
}
|
||||||
|
@ -911,6 +913,8 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
$status = 'taxable';
|
$status = 'taxable';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$status = strtolower( $status );
|
||||||
|
|
||||||
if ( ! in_array( $status, $options, true ) ) {
|
if ( ! in_array( $status, $options, true ) ) {
|
||||||
$this->error( 'product_invalid_tax_status', __( 'Invalid product tax status.', 'woocommerce' ) );
|
$this->error( 'product_invalid_tax_status', __( 'Invalid product tax status.', 'woocommerce' ) );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue