rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -781,7 +781,9 @@ class WC_Product extends WC_Abstract_Legacy_Product {
* @param string $visibility Options: 'hidden', 'visible', 'search' and 'catalog'.
*/
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 ) ) {
$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 = strtolower( $status );
if ( ! in_array( $status, $options, true ) ) {
$this->error( 'product_invalid_tax_status', __( 'Invalid product tax status.', 'woocommerce' ) );
}
@@ -1110,7 +1114,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
* position - integer sort order.
* visible - If visible on frontend.
* variation - If used for variations.
* Indexed by unqiue key to allow clearing old ones after a set.
* Indexed by unique key to allow clearing old ones after a set.
*
* @since 3.0.0
* @param array $raw_attributes Array of WC_Product_Attribute objects.
@@ -1386,7 +1390,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
return;
}
$stock_is_above_notification_threshold = ( $this->get_stock_quantity() > get_option( 'woocommerce_notify_no_stock_amount', 0 ) );
$stock_is_above_notification_threshold = ( (int) $this->get_stock_quantity() > absint( get_option( 'woocommerce_notify_no_stock_amount', 0 ) ) );
$backorders_are_allowed = ( 'no' !== $this->get_backorders() );
if ( $stock_is_above_notification_threshold ) {
@@ -1932,6 +1936,23 @@ class WC_Product extends WC_Abstract_Legacy_Product {
return apply_filters( 'woocommerce_product_single_add_to_cart_text', __( 'Add to cart', 'woocommerce' ), $this );
}
/**
* Get the aria-describedby description for the add to cart button.
*
* @return string
*/
public function add_to_cart_aria_describedby() {
/**
* Filter the aria-describedby description for the add to cart button.
*
* @since 7.8.0
*
* @param string $var Text for the 'aria-describedby' attribute.
* @param WC_Product $this Product object.
*/
return apply_filters( 'woocommerce_product_add_to_cart_aria_describedby', '', $this );
}
/**
* Get the add to cart button text.
*