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

Avatar: Rose Tyler
Rose Tyler
Support staff
September 16, 2022 at 13:57

Hello,

As we see in the product (1st link from private) you have successfully showed the text for https://prnt.sc/PE1RbLr1cVj4 using our code snippet.

All possible values you may use are here (they are created from your side) -> https://prnt.sc/tUMDPWLRmnRY or you may create new shipping classes and use new ones too.
Example:

function etheme_child_product_shipping_banner() {
global $product;

$shipping_class = $product->get_shipping_class();

switch ( $shipping_class ) {
case 'duze-inpost':
echo 'Kurier';
break;
case 'paleta-niestandardowa-dhl':
echo 'paleta-niestandardowa-dhl text';
break;
case 'lekker-niest-bez-pobrania':
echo 'lekker-niest-bez-pobrania custom text';
break;
}
}
add_action('woocommerce_before_single_product', 'etheme_child_product_shipping_banner', 20 );

P.S. Foreach item here -> https://prnt.sc/tUMDPWLRmnRY you may add own special

case 'your-slug':
        echo 'your custom text for this shipping class';
    break;

We hope, we provided you maximum detalized info about how to achieve your results.

Regards

Please contact administrator
for this information.
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.