Reply 334292 to: how to add shipping class in product page

Avatar: lew-shop
lew-shop
Participant
September 16, 2022 at 13:08

And what name should I enter in: case ‘free-shipping’

When I enter my name it doesn’t work. e.g:

function etheme_child_product_shipping_banner() {
global $product;

$shipping_class = $product->get_shipping_class();

switch ( $shipping_class ) {
    case 'free-shipping':
        echo 'Free shipping on this item';
    break;
    case 'flat-rate':
        echo 'Flat rate shpping $10';
    break;
}
}
add_action('woocommerce_before_single_product', 'etheme_child_product_shipping_banner', 20 );

Or maybe it can be done with a static block or custom html code in single product builder?
https://prnt.sc/5HHAnUsAUqxI

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.