Support » Plugin: Print Invoice & Delivery Notes for WooCommerce » Variation Meta prints details twice

  • Resolved evalast

    (@evalast)


    Hi, the following code in print-content.php echos both variation values belwo the product title after updating another plugin. The author of the other plugin says it has to do with your code. I was able to find the part which displays the varaiton details.

    The result looks e.g.like:

    Adidas Shirt
    Color:Red
    op_item_details:Red

    Any idea how to fix this issue?

    if ( isset( $item['variation_id'] ) && 0 !== $item['variation_id'] ) {
    	$variation = wc_get_product( $item['product_id'] );
    											foreach ( $item['item_meta'] as $key => $value ) {
    												if ( ! ( 0 === strpos( $key, '_' ) ) ) {
    													if ( is_array( $value ) ) {
    														continue;
    													}
    													$term_wp        = get_term_by( 'slug', $value, $key );
    													$attribute_name = wc_attribute_label( $key, $variation );
    													if ( isset( $term_wp->name ) ) {
    														echo '<br>' . wp_kses_post( $attribute_name . ':' . $term_wp->name );
    													} else {
    														echo '<br>' . wp_kses_post( $attribute_name . ':' . $value );
    													}
    												}
    											}
    • This topic was modified 4 months, 1 week ago by evalast.
Viewing 1 replies (of 1 total)
  • Plugin Support Upendra Kapse

    (@wpupen)

    Hi @evalast,

    Apologies for the delay in getting back to you on this.

    I just checked this on our end and the variation is getting printed fine just once in the Invoice. Can you please tell us if you have added the variations with the default WooCommerce way or you are using some plugin to modify them?

    Also, please tell me the other plugin you are referring to here so that I can test this by activating that plugin on our end.

    Kind Regards,
    Upendra.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.