Remove HTML from the configuration export, and add the image link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Trip the HTML from the configuration | |
add_filter( 'woe_get_order_product_value_Configuration', function( $value, $order, $item ) { | |
// Handle "dynamic data" orders | |
if ( strpos( $value, 'order-configuration-details' ) && function_exists( 'mkl_pc' ) && mkl_pc( 'admin' ) ) { | |
$meta = new stdClass(); | |
$meta->value = $value; | |
$value = mkl_pc( 'admin' )->order->format_meta( $value, $meta, $item ); | |
} | |
// Add line breaks and Remove html | |
if ( strpos( $value, 'order-configuration' ) ) { | |
$value = str_replace( '<div', "\n\r<div", $value ); | |
$value = trim( strip_tags( $value ) ); | |
} | |
return $value; | |
}, 20, 3 ); | |
// Add the image in an other column | |
add_filter( 'woe_get_order_product_value__config_image', function( $value, $order, $item ) { | |
if ( function_exists( 'mkl_pc' ) ) { | |
$img = mkl_pc( 'frontend' )->order->get_order_item_image( $item, 'url' ); | |
if ( $img ) { | |
$value = $img; | |
} | |
} | |
return $value; | |
}, 20, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment