1 回答

TA貢獻(xiàn)1891條經(jīng)驗(yàn) 獲得超3個(gè)贊
你是這個(gè)意思嗎?
function ut_before_calculate_totals( $cart_obj ) {
foreach( $cart_obj->get_cart() as $key => $value ) {
//echo '<pre>', print_r($value, 1), '</pre>';
// The variation ID
$variation_id = $value['data']->get_id();
// output
echo $variation_id . '<br>';
// Get post meta
$variations_num_cubic = get_post_meta( $variation_id, '_num_cubic_var', true );
// output
echo $variations_num_cubic . '<br>';
}
}
add_action( 'woocommerce_before_calculate_totals', 'ut_before_calculate_totals', 10, 1 );
- 1 回答
- 0 關(guān)注
- 103 瀏覽
添加回答
舉報(bào)