';
// Output columns for each product.
foreach ( $grouped_product_columns as $column_id ) {
do_action( 'woocommerce_grouped_product_list_before_' . $column_id, $grouped_product );
switch ( $column_id ) {
case 'quantity':
ob_start();
if ( ! $grouped_product->is_purchasable() || $grouped_product->has_options() || ! $grouped_product->is_in_stock() ) {
woocommerce_template_loop_add_to_cart();
} elseif ( $grouped_product->is_sold_individually() ) {
echo '';
} else {
do_action( 'woocommerce_before_add_to_cart_quantity' );
woocommerce_quantity_input( array(
'input_name' => 'quantity[' . $grouped_product->get_id() . ']',
'input_value' => isset( $_POST['quantity'][ $grouped_product->get_id() ] ) ? wc_stock_amount( wc_clean( wp_unslash( $_POST['quantity'][ $grouped_product->get_id() ] ) ) ) : 0, // WPCS: CSRF ok, input var okay, sanitization ok.
'min_value' => apply_filters( 'woocommerce_quantity_input_min', 0, $grouped_product ),
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $grouped_product->get_max_purchase_quantity(), $grouped_product ),
) );
do_action( 'woocommerce_after_add_to_cart_quantity' );
}
$value = ob_get_clean();
break;
case 'label':
$value = '';
break;
case 'price':
$value = $grouped_product->get_price_html() . wc_get_stock_html( $grouped_product );
break;
default:
$value = '';
break;
}
echo '' . apply_filters( 'woocommerce_grouped_product_list_column_' . $column_id, $value, $grouped_product ) . ' | '; // WPCS: XSS ok.
do_action( 'woocommerce_grouped_product_list_after_' . $column_id, $grouped_product );
}
echo '
';
}
$post = $previous_post; // WPCS: override ok.
setup_postdata( $post );
?>