';
// Output columns for each product.
foreach ( $grouped_product_columns as $column_id ) {
do_action( 'woocommerce_grouped_product_list_before_' . $column_id, $grouped_product_child );
switch ( $column_id ) {
case 'quantity':
ob_start();
if ( ! $grouped_product_child->is_purchasable() || $grouped_product_child->has_options() || ! $grouped_product_child->is_in_stock() ) {
woocommerce_template_loop_add_to_cart();
} elseif ( $grouped_product_child->is_sold_individually() ) {
echo '';
echo '';
} else {
do_action( 'woocommerce_before_add_to_cart_quantity' );
woocommerce_quantity_input( array(
'input_name' => 'quantity[' . $grouped_product_child->get_id() . ']',
'input_value' => isset( $_POST['quantity'][ $grouped_product_child->get_id() ] ) ? wc_stock_amount( wc_clean( wp_unslash( $_POST['quantity'][ $grouped_product_child->get_id() ] ) ) ) : 0, // phpcs:ignore WordPress.Security.NonceVerification.Missing
'min_value' => apply_filters( 'woocommerce_quantity_input_min', 0, $grouped_product_child ),
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $grouped_product_child->get_max_purchase_quantity(), $grouped_product_child ),
'placeholder' => '0',
) );
do_action( 'woocommerce_after_add_to_cart_quantity' );
}
$value = ob_get_clean();
break;
case 'label':
$value = '';
break;
case 'price':
$value = $grouped_product_child->get_price_html() . wc_get_stock_html( $grouped_product_child );
break;
default:
$value = '';
break;
}
echo '' . apply_filters( 'woocommerce_grouped_product_list_column_' . $column_id, $value, $grouped_product_child ) . ' | '; // WPCS: XSS ok.
do_action( 'woocommerce_grouped_product_list_after_' . $column_id, $grouped_product_child );
}
echo '
';
}
$post = $previous_post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
setup_postdata( $post );
do_action( 'woocommerce_grouped_product_list_after', $grouped_product_columns, $quantites_required, $product );
?>