|
197 | 197 | </span> |
198 | 198 |
|
199 | 199 | <?php |
200 | | - $item_meta_fields = wc_display_item_meta( $item, apply_filters( 'wcdn_product_meta_data', $item['item_meta'], $item ) ); |
| 200 | + $item_meta_fields = apply_filters( 'wcdn_product_meta_data', $item['item_meta'], $item ); |
201 | 201 | if ( null === $item_meta_fields ) { |
202 | 202 | $item_meta_fields = array(); |
203 | 203 | } |
|
209 | 209 | $product_addons = WC_Product_Addons_Helper::get_product_addons( $product_id ); |
210 | 210 | } |
211 | 211 | } |
212 | | - // Extra Product Options (ThemeComplete EPO) support. |
| 212 | + |
| 213 | + // --- handle YITH add-ons: print labels and remove raw ywapo-* meta to avoid duplicates --- |
| 214 | + $yith_addon_meta_map = array(); |
| 215 | + if ( isset( $item_meta_fields['_ywapo_meta_data'] ) && is_array( $item_meta_fields['_ywapo_meta_data'] ) ) { |
| 216 | + foreach ( $item_meta_fields['_ywapo_meta_data'] as $group ) { |
| 217 | + if ( ! is_array( $group ) ) { |
| 218 | + continue; |
| 219 | + } |
| 220 | + foreach ( (array) $group as $maybe ) { |
| 221 | + if ( isset( $maybe['addon_id'] ) ) { |
| 222 | + $option_id = isset( $maybe['option_id'] ) ? $maybe['option_id'] : 0; |
| 223 | + $meta_key = 'ywapo-addon-' . $maybe['addon_id'] . '-' . $option_id; |
| 224 | + $yith_addon_meta_map[ $meta_key ] = $maybe; |
| 225 | + } else { |
| 226 | + foreach ( (array) $maybe as $sub ) { |
| 227 | + if ( isset( $sub['addon_id'] ) ) { |
| 228 | + $option_id = isset( $sub['option_id'] ) ? $sub['option_id'] : 0; |
| 229 | + $meta_key = 'ywapo-addon-' . $sub['addon_id'] . '-' . $option_id; |
| 230 | + $yith_addon_meta_map[ $meta_key ] = $sub; |
| 231 | + } |
| 232 | + } |
| 233 | + } |
| 234 | + } |
| 235 | + } |
| 236 | + foreach ( $yith_addon_meta_map as $meta_key => $addon ) { |
| 237 | + if ( isset( $addon['display_label'] ) && isset( $addon['display_value'] ) ) { |
| 238 | + echo '<br><strong>' . esc_html( $addon['display_label'] ) . ' : </strong>' . wp_kses_post( $addon['display_value'] ); |
| 239 | + } else { |
| 240 | + if ( isset( $item_meta_fields[ $meta_key ] ) ) { |
| 241 | + echo '<br><strong>' . esc_html( $meta_key ) . ' : </strong>' . wp_kses_post( $item_meta_fields[ $meta_key ] ); |
| 242 | + } |
| 243 | + } |
| 244 | + if ( isset( $item_meta_fields[ $meta_key ] ) ) { |
| 245 | + unset( $item_meta_fields[ $meta_key ] ); |
| 246 | + } |
| 247 | + } |
| 248 | + } // --- end handle YITH add-ons --- |
| 249 | + // Extra Product Options (ThemeComplete EPO) support. |
213 | 250 | $epo_data = $item->get_meta( '_tmcartepo_data', true ); |
214 | 251 | if ( ! empty( $epo_data ) && is_array( $epo_data ) ) { |
215 | 252 | foreach ( $epo_data as $epo ) { |
|
218 | 255 | } |
219 | 256 | } |
220 | 257 | } |
| 258 | + |
221 | 259 | if ( version_compare( get_option( 'woocommerce_version' ), '3.0.0', '>=' ) ) { |
222 | 260 | if ( isset( $item['variation_id'] ) && 0 !== $item['variation_id'] ) { |
223 | 261 | $variation = wc_get_product( $item['product_id'] ); |
|
238 | 276 | } |
239 | 277 | } |
240 | 278 | if ( isset( $term_wp->name ) ) { |
241 | | - echo '<br>' . wp_kses_post( $attribute_name . ':' . $term_wp->name ); |
| 279 | + echo '<br>' . wp_kses_post( '<strong>' . $attribute_name . ' : </strong>' . $term_wp->name ); |
242 | 280 | } else { |
243 | | - echo '<br>' . wp_kses_post( $attribute_name . ':' . $value ); |
| 281 | + echo '<br>' . wp_kses_post( '<strong>' . $attribute_name . ' : </strong>' . $value ); |
244 | 282 | } |
245 | 283 | } |
246 | 284 | } |
|
259 | 297 | } |
260 | 298 | } |
261 | 299 | } |
262 | | - echo '<br>' . wp_kses_post( $key . ':' . $value ); |
| 300 | + echo '<br>' . wp_kses_post( '<strong>' . wc_attribute_label( $key ) . '</strong> : ' . $value ); |
263 | 301 | } |
264 | 302 | } |
265 | 303 | } |
|
0 commit comments