get_name(); if ( $product instanceof WC_Product_Variation && false === $exclude_variable_attribute ) { $name .= ' - ' . $product->get_attribute_summary(); } $formatted_price = BWFAN_Common::price( $line_total, $currency ); $price_display = $formatted_price; if ( $suffix && wc_tax_enabled() ) { $price_display .= ' ' . $suffix; } $product_names_with_price[] = $name . " ( " . $price_display . " )"; } } else { foreach ( $products as $product ) { if ( ! $product instanceof WC_Product ) { continue; } $price = isset( $products_price[ $product->get_id() ] ) ? $products_price[ $product->get_id() ] : null; $line_total = is_null( $price ) ? BWFAN_Common::get_prices_with_tax( $product ) : $price; $name = $product->get_name(); if ( $product instanceof WC_Product_Variation && false === $exclude_variable_attribute ) { $name .= ' - ' . $product->get_attribute_summary(); } /** Format the price properly */ $formatted_price = BWFAN_Common::price( $line_total, $currency ); /** Add suffix if enabled*/ $price_display = $formatted_price; if ( $suffix && wc_tax_enabled() ) { $price_display .= ' ' . $suffix; } $product_names_with_price[] = $name . " ( " . $price_display . " )"; } } $explode_operator = apply_filters( 'bwfan_product_name_separator', ', ' ); echo implode( $explode_operator, $product_names_with_price ); //phpcs:ignore WordPress.Security.EscapeOutput