How to change a WooCommerce Subscription Deposit and Monthly Payment? [closed]

I THINK I have achieved what I want in this far more simple fee hook, found here https://stackoverflow.com/questions/43415783/change-cart-total-price-in-woocommerce: function prefix_add_discount_line( $cart ) { $discount = $cart->subtotal_ex_tax * 0.1; $cart->add_fee( __( ‘10% Discount’, ‘yourtext-domain’ ) , -$discount ); } add_action( ‘woocommerce_cart_calculate_fees’, ‘prefix_add_discount_line’ ); This is taking 10% off the “To pay now” including tax and totals, … Read more

What Hook/Action is performed when a field in checkout form is changed in WooCommerce

You will need to use ajax to set values in WooCommerce session variables first. Once your values are set in wc()->session, then you can access them anywhere within the WooCommerce hooks or actions. See below code example: /*Ajax Call Back*/ add_action( ‘wp_ajax_my_action’, ‘my_action_callback’ ); $shipping_charges; function my_action_callback() { $shipping_charges = $_POST[‘shipping_charges’]; WC()->session->set(“th_shipping_charges”, $shipping_charges ); } … Read more

WordPress hook which triggers on post import

If you are trying to fire your function when the WordPress Importer runs, there are a few filters and action hooks available. From the plugin documentation: import_start: occurs after the export file has been uploaded and author import settings have been chosen import_end: called after the last output from the importer https://wordpress.org/plugins/wordpress-importer/

ajax problem – function on server is not called

My guess is that the shipping method isn’t initialised when you make an ajax call. Try moving your actions directly into your init function. EG: function checkAjax(){ print_r($_POST); exit; } function dhlsweden_shipping_method_init() { //use checkAjax since you don’t have access to your shipping method class. If this is the case then you need to rework … Read more

Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?

WordPress redirects you back to the user-edit.php page upon successful user update, so while the admin_notices has yet been fired in your sulock_save_profile_fields(), the message (your custom admin notice) is never displayed because of the redirection. And one way to fix it, is by filtering the redirect URL via the wp_redirect filter: // In sulock_save_profile_fields() … Read more

WooCommerce: after install hook

WooCommerce itself isn’t setting fresh_site to 0 directly (the string fresh_site doesn’t appear anywhere in WooCommerce’s source code), however you are correct that it’s happening because WooCommerce is creating pages. WordPress sets a site to not be fresh like this (from wp-includes/default-filters.php): // Mark site as no longer fresh foreach ( array( ‘publish_post’, ‘publish_page’, ‘wp_ajax_save-widget’, … Read more