WooCommerce - excelling eCommerce
Product dimensions for shipping calculation? (1 post)

  1. garyzaval
    Posted 2 years ago #

    Hi there.
    I'm trying to create a new shipping method for woocommerce. So i created a plugin as suggested. I'm trying to get the product dimensions height, width, length, weight, and besides the destination city. For now i'm stack in the dimensions, that it's the product variations for what i've read. But I tried to do the following but they seem to be empty.

    So I have this in the calculate_shipping function:

    foreach ( $woocommerce->cart->get_cart() as $item_id => $values ) {
                    $_product = $values['data'];
                    //debug: $firephp->log($_product, 'Iterators0');
                    $_variation_id = $values['variation_id'];
                    //debug: $firephp->log($_variation_id, 'Iterators1');
                    $_variation = $values['variation'];
                    //debug: $firephp->log($_variation, 'Iterators2');
                    if ( $values['quantity'] > 0 && $_product->needs_shipping() ) {
                        //my calculation
                        $shipping_total += $this->fee * $values['quantity'];

    Any help will be appreciated.



Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic