Skip to content

Commit d17a2a9

Browse files
committed
Fix #113
1 parent 46c6531 commit d17a2a9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

woocommerce-delivery-notes/templates/print-order/print-content.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@
140140

141141
<?php
142142

143+
$product_id = $item['product_id'];
144+
$product_addons = WC_Product_Addons_Helper::get_product_addons( $product_id );
143145
if ( version_compare( get_option( 'woocommerce_version' ), '3.0.0', '>=' ) ) {
144146
if ( isset( $item['variation_id'] ) && 0 !== $item['variation_id'] ) {
145147
$variation = wc_get_product( $item['product_id'] );
@@ -150,6 +152,13 @@
150152
}
151153
$term_wp = get_term_by( 'slug', $value, $key );
152154
$attribute_name = wc_attribute_label( $key, $variation );
155+
foreach ( $product_addons as $addon ) {
156+
if ( 'file_upload' === $addon['type'] ) {
157+
if ( $key === $addon['name'] ) {
158+
$value = wp_basename( $value );
159+
}
160+
}
161+
}
153162
if ( isset( $term_wp->name ) ) {
154163
echo '<br>' . wp_kses_post( $attribute_name . ':' . $term_wp->name );
155164
} else {
@@ -163,6 +172,13 @@
163172
if ( is_array( $value ) ) {
164173
continue;
165174
}
175+
foreach ( $product_addons as $addon ) {
176+
if ( 'file_upload' === $addon['type'] ) {
177+
if ( $key === $addon['name'] ) {
178+
$value = wp_basename( $value );
179+
}
180+
}
181+
}
166182
echo '<br>' . wp_kses_post( $key . ':' . $value );
167183
}
168184
}

0 commit comments

Comments
 (0)