$pr = wc_get_product();
echo $pr->get_short_description();
echo $pr->get_regular_price();
echo $pr->get_sale_price();
$term = get_queried_object();
$children = get_terms( $term->taxonomy, array(
'parent' => $term->term_id,
'hide_empty' => false
) );
// print_r($children); // uncomment to examine for debugging
if($children) { // get_terms will return false if tax does not exist or term wasn't found.
// term has children
}
public function calculate_shipping( $package ) {
global $woocommerce;
$customer = new WC_Cart();
$meePrice = $woocommerce->cart->subtotal;
$price = 500;
if($meePrice >= 5000) {
$price = 250;
}
$rate = array(
'id' => $this->id,
'label' => $this->title,
'cost' => $price,
'calc_tax' => 'per_item'
);
// Register the rate
$this->add_rate( $rate );
}