hook-woocommerce

Change order item displayed meta key label in WooCommerce admin order pages

五迷三道 提交于 2021-02-04 07:28:06
问题 Following Display a product custom field only in WooCommerce Admin single orders answer to my previous question, which: Adds a Custom SKU Field (ArticleID) Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data for Manual Orders How can I change the displayed meta key label _articleid on order line items section of the admin single order pages? Right now it shows the "SKU", the "Variation ID" (for product variations) and

Display tax amount based on specific tax class in WooCommerce variations

こ雲淡風輕ζ 提交于 2021-01-29 04:01:46
问题 I'm currently using a custom function to target a specific product and change the output of the price with and without tax on the product page. This currently works as intended for an individual product id, however trying to get this work for a specific tax_class instead with no avail add_filter( 'woocommerce_available_variation', 'tax_variation', 10, 3); function tax_variation( $data, $product, $variation ) { $product = wc_get_product(); $id = $product->get_id(); $price_excl_tax = wc_get

Sort WooCommerce Products by SKU Numeric (1.2.3.4.5.6…)

末鹿安然 提交于 2021-01-29 01:56:44
问题 In WooCommerce Version 4.2.2 on admin products list, when I try to sort products by SKU (column), the result is: 1 10 100 101 102 103 104 ... InsteadI would like it to be in natural order like: 1 2 3 4 5 ... 9 10 11 ... 99 ... 100 101 ... The same thing happens when I use WooCommerce Product Search (Version 2.21.0). Trying to understand what is happening I noticed that if I do a search in the admin panel for products it returns too many results and this does not happen to all products, some

Dynamic custom order numbers based on payment method

自闭症网瘾萝莉.ら 提交于 2021-01-28 22:44:45
问题 I have the following code in my functions.php file: add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number' ); function change_woocommerce_order_number( $order_id ) { $order = wc_get_order( $order_id ); //$order->get_total(); $method_of_payment = $order->get_payment_method(); if ( $method_of_payment == 'cheque' ) { $prefix = 'CHE'; $suffix = ''; $new_order_id = $prefix . $order_id . $suffix; return $new_order_id; } else { return $order_id; } } The code works but I want it to

Hide COD payment method based on shipping class in WooCommerce cart

江枫思渺然 提交于 2021-01-28 19:43:02
问题 As Salam o Alikum, I'm trying to hide cash on delivery payment method if the product in cart belongs to NOCOD shipping class. I have created a shipping class and its ID is 723, I tried to get help from everywhere on the web but unable to figure out that where I'm doing wrong. Based on web surfing, I have written code and added it to theme functions.php. Here is the code snippet. //disabling COD if shipping class is NOCOD. add_filter('woocommerce_available_payment_gateways', 'hide_cod_if

How to use the custom plugin with the priority order number?

心已入冬 提交于 2021-01-28 18:22:40
问题 I am learning WooCommerce development. I installed the pin checker plugin and that displays above the add to cart button. Screenshot here https://prnt.sc/xftmpn Now I have displayed the paragraph below of the pin checker and I used the below code but it's displaying above the pin checker. function action_woocommerce_single_product_pinchecker_content() { echo "<span>Please enter PIN code to check delivery time & other more</span>"; } add_action( 'woocommerce_single_product_summary', 'action

WooCommerce 4.0 custom checkout & ACF field value on email, admin order, and thank you page

怎甘沉沦 提交于 2021-01-28 17:52:30
问题 I'm having a hard time printing my custom field value to the email notifications, order admin and thank you page. I've browsed through StackOverflow, tried every single answer I found but unfortunately not working and I couldn't figure out the problem: I am trying to pass the value of the additional checkout field, it only prints the strong label with a blank value, and in the emails nothing shows, here is my code so far: //new pickup location checkout field add_action( 'woocommerce_before

WooCommerce 4.0 custom checkout & ACF field value on email, admin order, and thank you page

与世无争的帅哥 提交于 2021-01-28 17:47:28
问题 I'm having a hard time printing my custom field value to the email notifications, order admin and thank you page. I've browsed through StackOverflow, tried every single answer I found but unfortunately not working and I couldn't figure out the problem: I am trying to pass the value of the additional checkout field, it only prints the strong label with a blank value, and in the emails nothing shows, here is my code so far: //new pickup location checkout field add_action( 'woocommerce_before

Display and save formated dimensions of the product everywhere

血红的双手。 提交于 2021-01-28 15:27:36
问题 Inspired by Display the weight of cart and order items in WooCommerce @LoicTheAztec's answer, making some changes by replacing product weight by product dimensions, I am able to show the items dimensions everywhere on cart items and order items. The problem is that I don't know how to show the labels or adjectives: Longitud cm x Ancho cm x Alto cm for a Spanish site. I really appreciate any help. // Display the cart item dimensions in cart and checkout pages add_filter( 'woocommerce_get_item

Display and save formated dimensions of the product everywhere

蹲街弑〆低调 提交于 2021-01-28 15:26:58
问题 Inspired by Display the weight of cart and order items in WooCommerce @LoicTheAztec's answer, making some changes by replacing product weight by product dimensions, I am able to show the items dimensions everywhere on cart items and order items. The problem is that I don't know how to show the labels or adjectives: Longitud cm x Ancho cm x Alto cm for a Spanish site. I really appreciate any help. // Display the cart item dimensions in cart and checkout pages add_filter( 'woocommerce_get_item