Merge pull request #22997 from woocommerce/fix/22992

Add stock to search results manually
This commit is contained in:
Rodrigo Primo 2019-03-12 15:12:43 -03:00 committed by GitHub
commit 47135c6a68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -1562,7 +1562,9 @@ class WC_AJAX {
$managing_stock = $product_object->managing_stock();
if ( $managing_stock && ! empty( $_GET['display_stock'] ) ) {
$formatted_name .= ' – ' . wc_format_stock_for_display( $product_object );
$stock_amount = $product_object->get_stock_quantity();
/* Translators: %d stock amount */
$formatted_name .= ' – ' . sprintf( __( 'Stock: %d', 'woocommerce' ), wc_format_stock_quantity_for_display( $stock_amount, $product_object ) );
}
$products[ $product_object->get_id() ] = rawurldecode( $formatted_name );