Skip to content

Instantly share code, notes, and snippets.

@jordantrizz
Last active April 23, 2019 21:14
Show Gist options
  • Save jordantrizz/52d261567765c4ab8c1ffdab2aa9cdff to your computer and use it in GitHub Desktop.
Save jordantrizz/52d261567765c4ab8c1ffdab2aa9cdff to your computer and use it in GitHub Desktop.
Booster for WooCommerce Short Codes Showing Hidden Item Meta like _wc_cog and _reduced_stock
<?php
/*
* Plugin Name: Booster Hidden Item Meta Fix
* Plugin URI: https://www.geektank.net/2019/04/booster-for-woocommerce-showing-hidden-item-meta/
* Description: This plugin fixes hidden item meta from showing on specific Booster for WooCommerce shortcodes
* Author: Jordan
* Version: 0.1
The following code will hide meta for the following plugins which should not be shown as they're
suppose to be hidden.
WooCommerce Cost of Goods - https://woocommerce.com/products/woocommerce-cost-of-goods/
_wc_cog_item_cost
_wc_cog_item_total_cost
WooCommerce
_reduced_stock
https://www.geektank.net/2019/04/booster-for-woocommerce-showing-hidden-item-meta/
*/
add_filter( 'woocommerce_hidden_order_itemmeta', 'hide_my_item_meta' );
function hide_my_item_meta( $hidden_meta ) {
// Let's hide the meta data for WooCommerce Cost og
$hidden_meta = array(
'_reduced_stock',
'_wc_cog_item_cost',
'_wc_cog_item_total_cost'
);
return $hidden_meta;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment