php - Change total and tax_total Woocommerce -
i create custom checkout page custom calculation. how cant change total , tax_total via ajax (or refresh page if need).
i create custom page ajax request , set code
$ss = new wc_session_handler(); $ss->set('tax_total',9999999); $ss->save_data(); $ss->set('total',9999999); $ss->save_data(); var_dump(wc());
on page can see changes, 'checkout page' nothing happens (even after refresh). how can change arbitrary total
or tax_total
.
try use
add_action('woocommerce_calculate_totals', array($this, 'calculate_totals'), 10, 1); function calculate_totals($totals){ //your code }
also shoul tax_total
in cart object , can change it.
Comments
Post a Comment