Viewing 15 replies - 1 through 15 (of 16 total)
  • Add this snippet to functions.php for your child theme:

    add_action( 'woocommerce_single_product_summary', 'show_shipping', 35 );
    function show_shipping() {
      global $product;
      echo '<p class="shipping_class">Shipping class: '.$product->get_shipping_class().'</p>';
    }

    Thread Starter jamesscaife

    (@jamesscaife)

    Hi Lorro

    Could it show the title? It’s currently showing the slug.

    KR

    James

    add_action( 'woocommerce_single_product_summary', 'show_shipping', 35 );
    function show_shipping() {
      global $product;
      $class_id = $product->get_shipping_class_id();
      if ($class_id) {
        $term = get_term_by( 'id', $class_id, 'product_shipping_class' );
        echo '<p class="shipping_class">Shipping class: '.$term->name.'</p>';
      }
    }
    Thread Starter jamesscaife

    (@jamesscaife)

    Hi Lorro,

    That’s perfect thanks.

    There is a small problem with the leding on the right column.

    How can i make the spacing between each item, text and buttons alike 15px in the right column (except for the main body of text – the short product description)?

    Actually also now looking at the add to cart button on the product page (changed to ‘add to basket +) is out ofalignment across the single and variable product pages, can we fix this somehow?

    KR

    James

    I don’t know about making all the spaces 15px because there are various elements in there that display or not depending on the variation selected and its settings, so its quite complex markup. However, some improvement should be possible as follows:

    Look in your custom css at Theme Options > Advanced Styling. Find:
    .product .entry-summary .single_add_to_cart_button
    and remove the lines:
    margin-left: 18px !important;
    padding: 0 !important;

    Same place, look for:
    div.product form.cart .variations td.product_value
    and delete the line:
    padding-bottom: 30px;

    Have you tried the theme option to show variation attributes as buttons instead of as drop-downs?

    Thread Starter jamesscaife

    (@jamesscaife)

    Hi Lorro

    I’m afraid the buttons don’t work, but we do want to use the drop downs and swatches when we’ve solved a different issue we’re having…

    https://www.ads-software.com/support/topic/variations-and-swatches-woocommerce-dropdown-groups?replies=3

    Seriously don’t worry about that though, you’ve helped us more than enough!

    Still strugling to get it to align across all pages, so strange as it has only happened recently.

    KR

    James

    Thread Starter jamesscaife

    (@jamesscaife)

    Hi Lorro

    Any thoughts on the add to basket button alignment?

    It looks aligned to me. That’s what the removal of “margin-left: 18px !important;” was for. Please post a screenshot to show what’s not aligned.

    Thread Starter jamesscaife

    (@jamesscaife)

    Hi Lorro

    Sorry, it’s the text algnment:
    https://drive.google.com/file/d/0B3eyTCsPr9UoRG00aGJZNXZEX28/view?usp=sharing

    You can see it on this page here:
    https://olsonbaker.com/product/stupa/

    The boule looks OK. I don’t think the stupa is set up fully. It doesn’t show a price. I think it should have a white / yellow drop-down to be able to fully specify the required variation, then maybe it’ll produce a button with the correct classes.

    Thread Starter jamesscaife

    (@jamesscaife)

    Hi Lorro

    Loads of them aren’t aligned, also really struggling with the alignment across the whole column. We can’t get the vertical 15px we need between any of the elements to be consistant across products, including the horizontal ‘add to basket’ text which is still also off.

    https://olsonbaker.com/product/asteroidglass/
    https://olsonbaker.com/product/capsule-1-litre-stainless-steel-water-carafe/

    Thread Starter jamesscaife

    (@jamesscaife)

    I don’t think the wooommerce plugin is affecting it is it?

    We do have issues with this too, but will need woocommerce to help…
    https://www.ads-software.com/support/topic/variations-and-swatches-woocommerce-dropdown-groups?replies=3

    For the add-to-cart button text alignment:

    The Stupa still needs the variations to be setup fully, with a white/yellow drop-down.

    For the simple products, look for:

    div.product form.cart .button, #content div.product form.cart
    .button.single_add_to_cart_button

    in the custom css and take out:

    padding: 0 !important;

    this is causing the misalignment.

    Regarding the vertical 15px, I don’t think you can win with that because elements come in and out by Javascript depending on the option chosen.

    Regarding the swatches requirement, this looks like a non-trivial development project, probably disproportionate to the benefit. Consider using three separate variable products.

    Thread Starter jamesscaife

    (@jamesscaife)

    Thanks Lorro ??

    I agree, complelety trivial, unfortunately it’s essential for us to have it as explained. We used a TM GLobal forms for a while but then came across the issue of it not relating to stock.

    Hi Lorro (and all others),

    Great scripting ?? the shipping NAME does appear but what about the shipping COST?

    I want to show the price of the shipping class…

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Woocommerce – Retrieving Shipping Class – Displaying Shipping Class Product Page’ is closed to new replies.