Hi, sorry for the delayed answer.
This plugin doesn’t have a default integration with WooCommerce, so it depends on what you need to hide. If it’s a whole product from a list of products, I think it would be better for you to hook into some WooCommerce filter to change the post query, but the guys at the WooCommerce support forum will give you better advise than me on this.
However, if you just need to hide a part of a product, you can use the plugin functionality in your code passing the shortcode arguments as an array to the Hide_This class.
Here’s an example of how it can be done:
// Put the content you want to show or hide conditionally inside a variable.
$content = 'My HTML contents.';
if ( class_exists( 'Hide_This' ) ) {
// Construct an array with the shortcode arguments.
$atts = array(
'for' => 'all',
'exclude' => 'username:foo',
);
$hide_this = new Hide_This( $atts, $content );
echo $hide_this->content;
} else {
echo $content;
}
Please note that the $content
variable can be any kind of data: a string, an integer, an object, etc.
You can see the full list of arguments and accepted values here: https://www.ads-software.com/plugins/hide-this/.
Hope this helps ??