function edd_wallet_process_incentive() { if ($_REQUEST['gateway'] == 'wallet') { EDD()->session->set('wallet_has_incentives', '1'); } else { EDD()->session->set('wallet_has_incentives', null); } // Refresh the cart if (empty($_POST['billing_country'])) { $_POST['billing_country'] = edd_get_shop_country(); } ob_start(); edd_checkout_cart(); $cart = ob_get_clean(); $response = array('html' => $cart, 'tax_raw' => edd_get_cart_tax(), 'tax' => html_entity_decode(edd_cart_tax(false), ENT_COMPAT, 'UTF-8'), 'tax_rate_raw' => edd_get_tax_rate(), 'tax_rate' => html_entity_decode(edd_get_formatted_tax_rate(), ENT_COMPAT, 'UTF-8'), 'total' => html_entity_decode(edd_cart_total(false), ENT_COMPAT, 'UTF-8'), 'total_raw' => edd_get_cart_total()); echo json_encode($response); edd_die(); }
> <?php do_action('edd_checkout_table_tax_first'); ?> <th colspan="<?php echo edd_checkout_cart_columns(); ?> " class="edd_cart_tax"> <?php esc_html_e('Tax', 'helium'); ?> : <span class="edd_cart_tax_amount" data-tax="<?php echo edd_get_cart_tax(false); ?> "><?php echo esc_html(edd_cart_tax()); ?> </span> </th> <?php do_action('edd_checkout_table_tax_last'); ?> </tr> <?php } ?> <tr class="edd_cart_footer_row"> <?php do_action('edd_checkout_table_footer_first');
/** * Recalculate cart taxes * * @since 1.6 * @return void */ function edd_ajax_recalculate_taxes() { if (!edd_get_cart_contents()) { return false; } if (empty($_POST['billing_country'])) { $_POST['billing_country'] = edd_get_shop_country(); } ob_start(); edd_checkout_cart(); $cart = ob_get_clean(); $response = array('html' => $cart, 'tax_raw' => edd_get_cart_tax(), 'tax' => html_entity_decode(edd_cart_tax(false), ENT_COMPAT, 'UTF-8'), 'tax_rate_raw' => edd_get_tax_rate(), 'tax_rate' => html_entity_decode(edd_get_formatted_tax_rate(), ENT_COMPAT, 'UTF-8'), 'total' => html_entity_decode(edd_cart_total(false), ENT_COMPAT, 'UTF-8'), 'total_raw' => edd_get_cart_total()); echo json_encode($response); edd_die(); }
<?php do_action( 'edd_checkout_table_subtotal_last' ); ?> </tr> <?php endif; ?> <tr class="edd_cart_footer_row edd_cart_discount_row" <?php if( ! edd_cart_has_discounts() ) echo ' style="display:none;"'; ?>> <?php do_action( 'edd_checkout_table_discount_first' ); ?> <th colspan="<?php echo edd_checkout_cart_columns(); ?>" class="edd_cart_discount"> <?php edd_cart_discounts_html(); ?> </th> <?php do_action( 'edd_checkout_table_discount_last' ); ?> </tr> <?php if( edd_use_taxes() ) : ?> <tr class="edd_cart_footer_row edd_cart_tax_row"<?php if( ! edd_is_cart_taxed() ) echo ' style="display:none;"'; ?>> <?php do_action( 'edd_checkout_table_tax_first' ); ?> <th colspan="<?php echo edd_checkout_cart_columns(); ?>" class="edd_cart_tax"> <?php _e( 'Tax', 'edd' ); ?>: <span class="edd_cart_tax_amount" data-tax="<?php echo edd_get_cart_tax( false ); ?>"><?php echo esc_html( edd_cart_tax() ); ?></span> </th> <?php do_action( 'edd_checkout_table_tax_last' ); ?> </tr> <?php endif; ?> <tr class="edd_cart_footer_row"> <?php do_action( 'edd_checkout_table_footer_first' ); ?> <th colspan="<?php echo edd_checkout_cart_columns(); ?>" class="edd_cart_total"><?php _e( 'Total', 'edd' ); ?>: <span class="edd_cart_amount" data-subtotal="<?php echo edd_get_cart_total(); ?>" data-total="<?php echo edd_get_cart_total(); ?>"><?php edd_cart_total(); ?></span></th> <?php do_action( 'edd_checkout_table_footer_last' ); ?> </tr> </tfoot> </table>
/** * Validates the supplied discount sent via AJAX. * * @since 1.0 * @return void */ function edd_ajax_update_cart_item_quantity() { if (!empty($_POST['quantity']) && !empty($_POST['download_id'])) { $download_id = absint($_POST['download_id']); $quantity = absint($_POST['quantity']); $options = maybe_unserialize(stripslashes($_POST['options'])); edd_set_cart_item_quantity($download_id, absint($_POST['quantity']), $options); $total = edd_get_cart_total(); $return = array('download_id' => $download_id, 'quantity' => $quantity, 'taxes' => html_entity_decode(edd_cart_tax(), ENT_COMPAT, 'UTF-8'), 'subtotal' => html_entity_decode(edd_currency_filter(edd_format_amount(edd_get_cart_subtotal())), ENT_COMPAT, 'UTF-8'), 'total' => html_entity_decode(edd_currency_filter(edd_format_amount($total)), ENT_COMPAT, 'UTF-8')); echo json_encode($return); } edd_die(); }
/** * Get Total Cart Amount * * Gets the fully formatted total price amount in the cart. * uses edd_get_cart_amount(). * * @access public * @global $edd_options Array of all the EDD Options * @since 1.3.3 * @return string - the cart amount */ function edd_cart_total($echo = true) { global $edd_options; $total = apply_filters('edd_cart_total', edd_currency_filter(edd_format_amount(edd_get_cart_total()))); if (edd_is_cart_taxed()) { if (edd_prices_show_tax_on_checkout()) { $total .= '<br/><span>' . sprintf(__('(includes %s tax)', 'edd'), edd_cart_tax()) . '</span>'; } } if (!$echo) { return $total; } echo $total; }