Home › Forums › Support › Show Block Element by Wocommerce Shipping Class This topic has 3 replies, 3 voices, and was last updated 2 years, 6 months ago by Leo. Viewing 4 posts - 1 through 4 (of 4 total) Author Posts September 10, 2021 at 9:09 pm #1926407 Martyn Hi Guys, Is there a way to show and Block Element on products pages with certain woocommerce shipping classes? At the moment we are using inclusions and exclusions for product categories but it is becoming complex and the shipping class would simplify this. Cheers, Marty September 11, 2021 at 8:12 am #1926892 ElvinStaff Customer Support Hi Martyn, With the current options on the display rule location, I believe it’s limited to Product taxonomies like tag or categories. I’m not exactly sure but if I remember it right, shipping class, like variants are product meta. For this one, you may have to do things using generate_element_display. https://docs.generatepress.com/article/generate_element_display/ September 24, 2021 at 6:14 pm #1942104 Martyn Thanks Elvin, Would it look like: add_filter( 'generate_element_display', function( $display, $element_id ) { if ( 1478236 === $element_id && shipping class ( 'regular' ) ) { $display = true; } return $display; }, 10, 2 ); Cheers, Marty September 24, 2021 at 6:50 pm #1942125 LeoStaff Customer Support Hmm there shouldn’t be a space between shipping class. Looking at this example here: https://stackoverflow.com/questions/53258868/conditional-free-shipping-based-on-shipping-class-and-minimal-amount-in-woocomme So try something like this: add_filter( 'generate_element_display', function( $display, $element_id ) { if ( 1478236 === $element_id && 'regular' == $shipping_class ) { $display = true; } return $display; }, 10, 2 ); If not then you might need to check with WooCommerce to determine the correct conditional tag to use 🙂 Author Posts Viewing 4 posts - 1 through 4 (of 4 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In