We use the flag module to mark items that will have delays in shipping so that the customer knows that those items will be delayed before adding them to cart. In drupal 7, we excluded our "add to cart" button and "more info" button from display and used a global custom text to rewrite them with the following text displaying them inside a btn-bar div class.
<div class="btn-bar [flagged_1]">[flagged]<span class="atc">[add_to_cart_form]</span> <span class="moreinfo"><a href="[path]">More info</a></span></div>
We then use the following css to hide the add to cart, and more info elements when the flag is present in the button bar.
.btn-bar.pre-order .atc,
.btn-bar.pre-order .moreinfo{
display: none;
}
In Drupal 8, the functionality of this still works correctly (updating the replacement patterns of course), but there is apparently a security issue with rewriting forms, so the add to cart button won't render properly when being rewritten in a global custom text.
So my question is what is the "simplest" way to hide those 2 fields when that particular node is flagged? Can this be accomplished by adding some code to my custom theme for the view in question?