edd_ajax_recalculate_taxes

Recalculate cart taxes.

Description

edd_ajax_recalculate_taxes(); 

Usage

  1. if ( !function_exists( 'edd_ajax_recalculate_taxes' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'easy-digital-downloads/includes/ajax-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = edd_ajax_recalculate_taxes(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/ajax-functions.php  
  1. function edd_ajax_recalculate_taxes() { 
  2. if ( ! edd_get_cart_contents() ) { 
  3. return false; 
  4.  
  5. if ( empty( $_POST['billing_country'] ) ) { 
  6. $_POST['billing_country'] = edd_get_shop_country(); 
  7.  
  8. ob_start(); 
  9. $cart = ob_get_clean(); 
  10. $response = array( 
  11. 'html' => $cart,  
  12. 'tax_raw' => edd_get_cart_tax(),  
  13. 'tax' => html_entity_decode( edd_cart_tax( false ), ENT_COMPAT, 'UTF-8' ),  
  14. 'tax_rate_raw' => edd_get_tax_rate(),  
  15. 'tax_rate' => html_entity_decode( edd_get_formatted_tax_rate(), ENT_COMPAT, 'UTF-8' ),  
  16. 'total' => html_entity_decode( edd_cart_total( false ), ENT_COMPAT, 'UTF-8' ),  
  17. 'total_raw' => edd_get_cart_total(),  
  18. ); 
  19.  
  20. echo json_encode( $response ); 
  21.  
  22. edd_die();