hook-woocommerce

How to display the regular price and sale price in single product and loop pages? [duplicate]

别等时光非礼了梦想. 提交于 2020-01-16 18:27:29
问题 This question already has an answer here : Display the discounted percentage near sale price in Single product pages for WC 3.0+ (1 answer) Closed 2 years ago . I had this code in function.php of my child theme to display the regular price and sale price and it was working fine in WooCommerce v2.6.14. But this snippet doesn't work anymore on WooCommerce version 3.2.3. How can I fix that? Here is that code: add_filter( 'woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2 );

Display order total with and without VAT in Woocommerce's order email notification

两盒软妹~` 提交于 2020-01-15 10:18:01
问题 I'm trying to edit the order email to add non-VAT price ! As I've not already found a way to do it the way I wanted using email-order-details.php and as I'm afraid of broking things even in a child theme .php document, I've try to do it with my own snippets, working trough function.php : add_action( 'woocommerce_email_after_order_table', 'add_order_email_instructions', 10, 2 ); function add_order_email_instructions( $order, $sent_to_admin ) { $order_data = $order->get_data(); $order_total =

Display order total with and without VAT in Woocommerce's order email notification

╄→гoц情女王★ 提交于 2020-01-15 10:17:30
问题 I'm trying to edit the order email to add non-VAT price ! As I've not already found a way to do it the way I wanted using email-order-details.php and as I'm afraid of broking things even in a child theme .php document, I've try to do it with my own snippets, working trough function.php : add_action( 'woocommerce_email_after_order_table', 'add_order_email_instructions', 10, 2 ); function add_order_email_instructions( $order, $sent_to_admin ) { $order_data = $order->get_data(); $order_total =

Populating Woocommerce Custom Fields

a 夏天 提交于 2020-01-15 04:00:11
问题 I'm having issues populating information gained through custom fields on a Woocommerce sign up page, when filling out the form the only things that seem to get pulled over are: First Name, Last Name, City, Postcode, Phone & Email Address. When a user signs up for our site, they cannot immediately login as their account needs to be approved by an admin, the information pulling through will be used to contact the person prior to their account being activated. I have tried dumping the $_POST

Move product meta to the description tab in WooCommerce

元气小坏坏 提交于 2020-01-14 14:40:11
问题 How to move the product meta to the beginning of the product description tab? I try: remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 ); add_action( 'woocommerce_product_tabs_description', 'woocommerce_template_single_meta', 10 ); Remove works, but add_action() doesn't. 回答1: You can keep: remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 ); To add the single product meta inside the description tab you can not

Get a custom field value saved in Order items meta in a hooked function

孤街浪徒 提交于 2020-01-14 05:09:09
问题 I am able to add, validate, display on cart and checkout page a custom field on the Product Page.Please can someone tell me how can I retrieve the custom field values using woocommerce_order_status_completed hook? I want to send an additional email including the custom field data after the confirmation email is sent to the user static function sendCustomData($order_id) { $order = wc_get_order($order_id); $items = $order->get_items(); foreach ($items as $item) { $product_id = $item['product_id

Display billing and shipping fields in “Pay to order” page Woocommerce

感情迁移 提交于 2020-01-14 03:52:10
问题 When I create a custom order for clients, they have to pay it in their account. But when they access to the order pay page, no shipping and billing fields is showing. How to do it ? I know that the template is form-pay.php Thanks 回答1: Add this to your theme's 'woocommerce/checkout/form-pay.php'. <!-- Display Information --> <h2 class="woocommerce-column__title"><?php esc_html_e( 'Billing address', 'woocommerce' ); ?></h2> <address> <?php echo wp_kses_post( $order->get_formatted_billing

Add text before product price if it's higher than a specific amount in Woocommerce

前提是你 提交于 2020-01-13 20:43:28
问题 In Woocommerce I'm trying to add text before price if is higher than 59€ I tried the following code (and others one) but they didn't work: add_filter( 'woocommerce_get_price_html', 'custom_price_message' ); function custom_price_message( $price ) { if ($price>='59'){ $new_price = $price .__('(GRATIS!)'); } return $new_price; } How can I do to add (GRATIS!) text before product price if it's higher than 59? 回答1: Updated: You should try the following revisited function code: add_filter(

Add text before product price if it's higher than a specific amount in Woocommerce

佐手、 提交于 2020-01-13 20:43:23
问题 In Woocommerce I'm trying to add text before price if is higher than 59€ I tried the following code (and others one) but they didn't work: add_filter( 'woocommerce_get_price_html', 'custom_price_message' ); function custom_price_message( $price ) { if ($price>='59'){ $new_price = $price .__('(GRATIS!)'); } return $new_price; } How can I do to add (GRATIS!) text before product price if it's higher than 59? 回答1: Updated: You should try the following revisited function code: add_filter(

Replace woocommerce_add_order_item_meta hook in Woocommerce 3.4

孤街浪徒 提交于 2020-01-09 03:53:21
问题 I have custom code use woocommerce_add_order_item_meta hook. But woocommerce 3.4.0 show error log: "woocommerce_add_order_item_meta is deprecated since version 3.0.0! Use woocommerce_new_order_item instead." How to fix it? Thank you very much. My code: // add data design to order function tshirt_order_meta_handler( $item_id, $values, $cart_item_key ) { if( WC()->session->__isset( $cart_item_key.'_designer' ) ) { wc_add_order_item_meta( $item_id, "custom_designer", WC()->session->get( $cart