Custom Text on Product Page based on Shipping Class [closed]
To display something above the product page, hook into woocommerce_before_single_product, and to get the shipping class use the get_shipping_class() method on the product, which can be retrieved with wc_get_product(): function wpse_295878_shipping_banner() { $product = wc_get_product(); $shipping_class = $product->get_shipping_class(); switch ( $shipping_class ) { case ‘free-shipping’: echo ‘<div class=”woocommerce-info”>Free shipping on this item</div>’; break; case ‘flat-rate’: … Read more