hook-woocommerce

Display a custom message for guest users in Woocommerce checkout page

左心房为你撑大大i 提交于 2019-12-01 11:18:51
问题 can use hook (hack) in functions.php show custom message for guest users in woocommerce checkout page? Or from another way? i need show message when active enabled registration on the checkout page. in woocommerce account settings. or enable guest checkout in checkout settings tab. because when deactivate this option, and guest option. one message show in checkout page (from woocommerce language file) esay change from edit language files. I would show my custom message to visitors when

Change checkout order review section in Woocommerce

倖福魔咒の 提交于 2019-12-01 11:14:23
In Woocommerce, I have successfully moved the payment methods section before he review order table: Change payment methods location before order details table in Woocommerce . I would like to add an <h3> headline ("Your order") and a <p> paragraph ("I have accepte the terms…") in checkout page, just above the review order table. You will replace in your existing code the following block: add_action( 'woocommerce_checkout_order_review', 'reordering_checkout_order_review', 1 ); function reordering_checkout_order_review(){ remove_action('woocommerce_checkout_order_review','woocommerce_checkout

Avoid repetitive emails notification on some auto completed orders

a 夏天 提交于 2019-12-01 10:50:00
I'm using this little peace of code on WooCommerce from this answer to auto-complete paid processing orders based on payment gateways: /** * AUTO COMPLETE PAID ORDERS IN WOOCOMMERCE */ add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_paid_order', 10, 1 ); function custom_woocommerce_auto_complete_paid_order( $order_id ) { if ( ! $order_id ) { return; } $order = wc_get_order( $order_id ); // No updated status for orders delivered with Bank wire, Cash on delivery and Cheque payment methods. if ( ( get_post_meta($order->id, '_payment_method', true) == 'bacs' ) || ( get_post

WooCommerce Cart - Dynamic Price variable pass into custom price hook

只谈情不闲聊 提交于 2019-12-01 09:13:04
I am getting the dynamic custom price in a variable that I want to pass to the hooked function in woocommerce_before_calculate_totals hook in cart. But it isn't working. This is my code: $add=200; //I want to pass this variable in add_action hook add_action( 'woocommerce_before_calculate_totals', 'add_custom_total_price'); function add_custom_total_price($cart_object) { global $woocommerce; $custom_price =$add; // This is my custom price foreach ( $cart_object->cart_contents as $key => $value ) { $value['data']->price = $custom_price; } } How can I achieve this? Thanks To make it work you just

Get the product price in Woocommerce 3

独自空忆成欢 提交于 2019-12-01 09:07:31
I'm trying to get price without currency in a function I made. function add_price_widget() { global $woocommerce; $product = new WC_Product(get_the_ID()); $thePrice = $product->get_price_html(); echo thePrice; } Displays: 100kr How do I get it to just give me the price 100 What @Syntax_Error had said is correct you have to use get_price() , WooCOmmerce also provide a wrapper function wc_get_product() for WC_Product class. So your function would look something like this: function add_price_widget() { $product = wc_get_product(get_the_ID()); $thePrice = $product->get_price(); //will give raw

Change checkout order review section in Woocommerce

跟風遠走 提交于 2019-12-01 08:51:54
问题 In Woocommerce, I have successfully moved the payment methods section before he review order table: Change payment methods location before order details table in Woocommerce. I would like to add an <h3> headline ("Your order") and a <p> paragraph ("I have accepte the terms…") in checkout page, just above the review order table. 回答1: You will replace in your existing code the following block: add_action( 'woocommerce_checkout_order_review', 'reordering_checkout_order_review', 1 ); function

Avoid repetitive emails notification on some auto completed orders

浪尽此生 提交于 2019-12-01 07:55:27
问题 I'm using this little peace of code on WooCommerce from this answer to auto-complete paid processing orders based on payment gateways: /** * AUTO COMPLETE PAID ORDERS IN WOOCOMMERCE */ add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_paid_order', 10, 1 ); function custom_woocommerce_auto_complete_paid_order( $order_id ) { if ( ! $order_id ) { return; } $order = wc_get_order( $order_id ); // No updated status for orders delivered with Bank wire, Cash on delivery and Cheque

Get the product price in Woocommerce 3

别来无恙 提交于 2019-12-01 06:34:58
问题 I'm trying to get price without currency in a function I made. function add_price_widget() { global $woocommerce; $product = new WC_Product(get_the_ID()); $thePrice = $product->get_price_html(); echo thePrice; } Displays: 100kr How do I get it to just give me the price 100 回答1: What @Syntax_Error had said is correct you have to use get_price(), WooCOmmerce also provide a wrapper function wc_get_product() for WC_Product class. So your function would look something like this: function add_price

Add a new custom checkout field before billing details in Woocommerce?

北城余情 提交于 2019-12-01 00:39:48
I can add a set of custom fields to my WooCommerce checkout screen but need to move it above the 'Billing Details'. How can that be done? According to this official WooCommerce documentation , here is an example code to add extra custom checkout fields: /** * Add the field to the checkout */ add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' ); function my_custom_checkout_field( $checkout ) { echo '<div id="my_custom_checkout_field"><h2>' . __('My Field') . '</h2>'; woocommerce_form_field( 'my_field_name', array( 'type' => 'text', 'class' => array('my-field-class form-row

Automatic text in short description of WooCommerce products

自闭症网瘾萝莉.ら 提交于 2019-12-01 00:32:48
I am trying to create an automatic text in the description of the WooCommerce articles and put "article only available in the store." I thought about putting it inside a function like this: add_filter ('woocommerce_short_description', 'in_single_product', 10, 2); function in_single_product () { echo '<p> article only available in the store. </ p>'; } But this replace the text that is already written in the short description of the product. If I have not put text, nothing appears. Is possible put the text of the code "article only available in the store" without a short description of the