daily pastebin goal
32%
SHARE
TWEET

WooCommerce - Show shipping class on product pages

lorro Nov 19th, 2016 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.   // WooCommerce - Show shipping class on product pages
  3.   // code goes in functions.php for your child theme above add-to-cart button
  4.   add_action( 'woocommerce_single_product_summary', 'show_shipping', 35 );
  5.   function show_shipping() {
  6.     global $product;
  7.     $class_id = $product->get_shipping_class_id();
  8.     if ($class_id) {
  9.       $term = get_term_by( 'id', $class_id, 'product_shipping_class' );
  10.       echo '<p class="shipping_class">Shipping class: '.$term->name.'</p>';
  11.     }
  12.   }
RAW Paste Data
Top