hook-woocommerce

Stop specific customer email notification based on payment methods in Woocommerce

こ雲淡風輕ζ 提交于 2019-12-08 04:55:49
问题 In Woocommerce, I need to stop email notifications sent to the customer when order place except when payment_method is BACS (Direct bank transfer). I tried following in my active theme's function.php file: add_filter( 'woocommerce_email_recipient_customer_on_hold_order_order', 'customer_order_email_if_bacs', 10, 2 ); function customer_order_email_if_bacs( $recipient, $order ) { if( $order->payment_method() !== 'bacs' ) $recipient = ''; return $recipient; } But it don't work. Any help is

Hooks and their hooked functions execution queue in Wordpress and Woocommerce

别说谁变了你拦得住时间么 提交于 2019-12-08 04:32:10
问题 I am new to Wordpress/WooCommerce and PHP, although I have experience in other web platforms and languages. I have searched, but have not found the answer to my question which is... Are hooks that are created by the "add_action" "added" to the list of actions called by that specific hook, or do they override any existing hooks of that action? For example, if I add a woocommerce_thankyou hook using: add_action( 'woocommerce_thankyou', 'order_created_get_skus',#); Question: Does this override

Different Messages Based on WooCommerce Page

≡放荡痞女 提交于 2019-12-08 04:07:19
问题 I am trying to alter messages displayed when adding an a product to cart and/ or updating the cart by hooking in to the woocommerce_add_message . It's not showing anything at all and I'm wondering why. I've tried echo and I've tried return__( Here's the code: add_filter('woocommerce_add_message', 'change_cart_message', 10); function change_cart_message() { $ncst = WC()->cart->subtotal; if ( is_checkout() ) { echo 'Your new order subtotal is: '.$ncst.'. <a style="color: green;" href="#customer

Change Cart total using Hooks in Woocommerce 3.2+

a 夏天 提交于 2019-12-08 04:00:09
问题 I want to add 300 to order total on woocommerce checkout page but woocommerce_calculate_totals hook doesn't do the job... If I use var_dump($total), I see the correct result - int(number), but the total amount in order table is not changing. add_action( 'woocommerce_calculate_totals', 'action_cart_calculate_totals', 10, 1 ); function action_cart_calculate_totals( $cart_object) { if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; if ( !WC()->cart->is_empty() ): $total = $cart_object->cart

Add a WooCommerce Orders List Column and value

让人想犯罪 __ 提交于 2019-12-08 03:49:29
In woo commerce order page(Admin Side) I want to add Drop Shipping column in order list which I done through add_filter( 'manage_edit-shop_order_columns', 'custom_shop_order_column', 20 ); function custom_shop_order_column($columns) { $reordered_columns = array(); // Inserting columns to a specific location foreach( $columns as $key => $column){ $reordered_columns[$key] = $column; if( $key == 'order_total' ){ $reordered_columns['drop_shipping'] = __( 'Drop Shipping','twentyseventeen'); } } return $reordered_columns; } It works Now I want to show populate data in that field I found the solution

When changing woocommerce title hook the first item doesn't change

血红的双手。 提交于 2019-12-08 02:29:13
问题 I have a strange behaviour that I don't understand I've changed the woocommerce_shop_loop_item_title hook to add a link to the title of the product. This is my code inside functions.php // Add HREF TO TITLE function abChangeProductsTitleHook(){ remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 ); add_action('woocommerce_shop_loop_item_title', 'abChangeProductsTitle', 10 ); } add_action( 'woocommerce_shop_loop_item_title',

Add a custom cart item value to WooCommerce order item meta data

久未见 提交于 2019-12-08 02:20:05
问题 I'm trying add order item meta and expect to see it in my {prefix}woocommerce_order_itemmeta table when user submit order. I add my value with woocommerce_add_cart_item_data filter: add_filter( 'woocommerce_add_cart_item_data', 'aa_func_20170206100217', 10, 3 ); function aa_func_20170206100217( $cart_item_data, $product_id, $variation_id ) { $data = $_POST; if ( isset( $data[ 'selected_date_event' ] ) ) { $selected_date_event = [ 'selected_date_event' => $data[ 'selected_date_event' ] ];

WooCommerce hook after order is updated?

孤街醉人 提交于 2019-12-08 01:39:26
问题 Is there a hook I can use when I make a change to someone's order via the admin (such as their address, or a custom meta field)? I read this question but unfortunately woocommerce_process_shop_order_meta is fired before the order is saved, meaning I have no access to the newly updated data. What I need is to be able to use the new data that is saved to the order. UPDATE: An issue with using save_post_shop_order is that the meta is updated before this is hit, so I can't compare the previously

How to add a heading above woocommerce-account-fields in Woocommerce

可紊 提交于 2019-12-08 00:04:09
问题 Preamble My question is very similar to the one asked here. The answer, I suspect, will also be very similar to the one here. Scenario The checkout page displays the typical Billing fields. Below those is the div class woocommerce-account-fields , in which is the div class create-account . The form nested in that has two fields, account_username and account_password . I want to hook into this and display a heading below the last billing field ( billing_email ) and above the account_username

Add custom order status to filter menu in WooCommerce Admin Orders list

匆匆过客 提交于 2019-12-07 22:25:59
问题 I'm currently trying to add new quick filters (subsubsub) to the WooCommerce admin orders list: I've a custom order status which is named "wc-test-accepted". How can I add a new quick filter for my custom order status to the top? 回答1: To get the related filter to your custom order status "wc-test-accepted" in the orders statuses menu filter, you just need to change the status of at least one order and the filter will appear. The following code will add new a custom order status "wc-test