• 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.

    Thanks,
    Gary

    http://wordpress.org/plugins/woocommerce/

  • The topic ‘Product dimensions for shipping calculation?’ is closed to new replies.