Skip to content

Instantly share code, notes, and snippets.

@marcusig
Created December 12, 2022 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusig/0434c342c11a151b1659b3b05a41c09b to your computer and use it in GitHub Desktop.
Save marcusig/0434c342c11a151b1659b3b05a41c09b to your computer and use it in GitHub Desktop.
Product Configurator: Remove HTML from the Admin order configuration
<?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