Created
December 12, 2022 12:59
-
-
Save marcusig/0434c342c11a151b1659b3b05a41c09b to your computer and use it in GitHub Desktop.
Product Configurator: Remove HTML from the Admin order configuration
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 | |
// Strip the HTML from the configuration | |
add_filter( 'woocommerce_order_item_get_formatted_meta_data', function( $formatted_meta, $order_item ) { | |
// Handle "dynamic data" orders | |
foreach( $formatted_meta as $index => $meta ) { | |
if ( property_exists( $meta, 'value' ) && strpos( $meta->value, 'order-configuration' ) && function_exists( 'mkl_pc' ) && mkl_pc( 'admin' ) ) { | |
$meta->value = str_replace( '<div', "\n\r<div", $meta->value ); | |
$meta->value = trim( strip_tags( $meta->value ) ); | |
$formatted_meta[$index] = $meta; | |
} | |
} | |
return $formatted_meta; | |
}, 120, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment