Added filter for HTML that displays stock levels
This commit is contained in:
parent
6ff1a4eea1
commit
a88d47c6d5
|
@ -284,9 +284,9 @@ if (!function_exists('woocommerce_simple_add_to_cart')) {
|
|||
// No price set - so no button
|
||||
if( $_product->get_price() === '') return;
|
||||
|
||||
if ($availability['availability']) : ?>
|
||||
<p class="stock <?php echo $availability['class'] ?>"><?php echo $availability['availability']; ?></p>
|
||||
<?php endif;
|
||||
if ($availability['availability']) :
|
||||
echo apply_filters( 'woocommerce_stock_html', 'woocommerce_simple_add_to_cart', '<p class="stock '.$availability['class'].'">'.$availability['availability'].'</p>', $availability['availability'] );
|
||||
endif;
|
||||
|
||||
// Don't show cart if out of stock
|
||||
if (!$_product->is_in_stock()) :
|
||||
|
@ -337,7 +337,10 @@ if (!function_exists('woocommerce_grouped_add_to_cart')) {
|
|||
echo $child_product->get_title();
|
||||
if ($child_product->is_visible()) echo '</a>';
|
||||
?></label></td>
|
||||
<td class="price"><?php echo $child_product->get_price_html(); ?><small class="stock <?php echo $cavailability['class'] ?>"><?php echo $cavailability['availability']; ?></small></td>
|
||||
<td class="price"><?php echo $child_product->get_price_html(); ?>
|
||||
<?php echo apply_filters( 'woocommerce_stock_html', 'woocommerce_grouped_add_to_cart',
|
||||
'<small class="stock '.$cavailability['class'].'">'.$cavailability['availability'].'</small>', $cavailability['availability'] ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
@ -377,7 +380,8 @@ if (!function_exists('woocommerce_variable_add_to_cart')) {
|
|||
|
||||
$variation_attributes = $variation->get_variation_attributes();
|
||||
$availability = $variation->get_availability();
|
||||
$availability_html = (!empty($availability['availability'])) ? '<p class="stock '.$availability['class'].'">'. $availability['availability'].'</p>' : '';
|
||||
$availability_html = (!empty($availability['availability'])) ? apply_filters( 'woocommerce_stock_html', 'woocommerce_variable_add_to_cart',
|
||||
'<p class="stock '.$availability['class'].'">'. $availability['availability'].'</p>', $availability['availability'] ) : '';
|
||||
|
||||
if (has_post_thumbnail($variation->get_variation_id())) {
|
||||
$attachment_id = get_post_thumbnail_id( $variation->get_variation_id() );
|
||||
|
@ -433,7 +437,7 @@ if (!function_exists('woocommerce_variable_add_to_cart')) {
|
|||
endif;
|
||||
?>
|
||||
<?php endif;?>
|
||||
</select></td>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in New Issue