How to access Woocommerce Product Dimensions? -


i'm trying create new shipping method woocommerce. created plugin suggested. i'm trying product dimensions height, width, length, weight, , besides destination city. i'm stack in dimensions, it's product variations i've read. tried following seem empty.

so have in calculate_shipping function:

foreach ( $woocommerce->cart->get_cart() $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 appreciated.

thanks, gary

try , should return value of weight. can adapt other values wanting get.

foreach ( $woocommerce->cart->get_cart() $item_id => $values ) {              $_product = $values['data'];             $weight = $_product->weight;              }

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -