product

Show products name and quantity in a new column on Woocommerce My account Orders

蹲街弑〆低调 提交于 2021-02-04 06:36:25
问题 In Woocommerce, I would like to add a new column to My account orders list and show the name and quantity of ordered the products. I have this code for instance that adds a new column displaying the order name: function sv_wc_add_my_account_orders_column( $columns ) { $new_columns = array(); foreach ( $columns as $key => $name ) { $new_columns[ $key ] = $name; if ( 'order-status' === $key ) { $new_columns['order-ship-to'] = __( 'Ship to', 'textdomain' ); } } return $new_columns; } add_filter(

How can I round up the price in WooCommerce?

亡梦爱人 提交于 2021-01-28 18:25:10
问题 I'd like to know if there is a way to round up the prices in WooCommerce keeping 2 decimals displayed (so the price will end with the first and second decimal ,00). For example: €12,54 will be rounded to €13,00 and €145,67 will be rounded up to €146,00. I'm using a plugin to discount the product price i.e. €39,00 - 20% = €35,10 (it should became €36,00). I'd like to round up all the prices as explained before. Is there a way to do so? 回答1: You can't really round up globally all real

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

Display prefixed price and additional unit price in Woocommerce simple products

核能气质少年 提交于 2021-01-28 12:26:00
问题 Using Woocommerce I sell wine per box with 6 bottles in a box. So naturally I enter a price per box when setting up my product. I do however want the user to see the price per bottle as well. $120 / box $20 / bottle I tried using Display on shop pages the unit price and the wholesale price on product pages answer code. It does exactly what I want, except, it removes the original ( per box ) price. The edited snippet below display both the original $price and the unit $price as well as the

Memory leakage issue in python list

丶灬走出姿态 提交于 2021-01-28 11:25:25
问题 The bounty expires in 4 days . Answers to this question are eligible for a +100 reputation bounty. Khawar Islam is looking for an answer from a reputable source . The identities list contains an big array of approximately 57000 images . Now, I am creating a negative list with the help of itertools.product() . This store the whole list in memory which is very costly and my system hanged after 4 minutes. How can i optimize the below code and avoid saving in memory?` for i in range(0, len

Conditionally change products tax class via hooks in WooCommerce

若如初见. 提交于 2021-01-28 08:56:50
问题 I have implemented a b2b area into my WooCommerce Shop about 18 months ago. Recently I have updated all plugins and wordpress itself. Switching the tax class on variable products doesn't work anymore. The code below worked so far, but stopped working. What am I missing? add_filter('woocommerce_product_get_price', 'switch_price', 99, 2); add_filter('woocommerce_product_variation_get_price', 'switch_price', 99, 2); function switch_price($price, $product){ if(isset($_COOKIE["customerType"])){ if

Avoid error “call to a member function get_cart()…” in WooCommerce function

只愿长相守 提交于 2021-01-28 07:41:27
问题 Receiving an error on a code that did work previously but now it is stopping me editing a page in wordpress (As when I attempt to edit a page, it states there's been a critical error). The code below basically changes text for add to cart button depending if the related product is in the cart. Code below and error exception below that: function woocommerce_custom_add_to_cart_text($add_to_cart_text, $product ) { global $woocommerce; // Get cart $cart_items = $woocommerce->cart->get_cart();

Display Woocommerce product attribute on archive page

白昼怎懂夜的黑 提交于 2021-01-28 07:31:05
问题 I have set up an attribute for my products for a delivery time. And I am using the following functions to display it on product archives, on single product pages, on Orders and emails notifications: add_action( 'woocommerce_single_product_summary', 'product_attribute_delivery', 27 ); function product_attribute_delivery(){ global $product; $taxonomy = 'pa_delivery'; $value = $product->get_attribute( $taxonomy ); if ( $value && $product->is_in_stock() ) { $label = get_taxonomy( $taxonomy )-

How to automatically create an account if a product in the order belongs to a certain category in WooCommerce

↘锁芯ラ 提交于 2021-01-28 05:54:35
问题 I have a WooCommerce shop where customers checkout as guests. I now want to sell a couple of virtual products and in that case I want to auto create an account. So I have two working code snippets. One to check if a product in cart is within a specific category (online) One to auto create an account from guest checkout. But I can't figure out how to combine these two so they work together. Or is it a better solution for this? Any ideas? Here is the two code snippets I started with and then

Hide displayed product prices from Woocommerce Product Add-ons Fields

╄→гoц情女王★ 提交于 2021-01-28 05:25:46
问题 In Woocommerce I am using Woocommerce Product Add-Ons plugin and I am trying to figure out how I can hide the prices from Add-ons fields. This is the current output with prices: This is the desired Output without prices (yellow underlined) : I figured out that the the select.php in product-addons/templates/addons/select.php could be the the solution I'm bad in php so i try to comment out some things ... if I comment out line 27 then I have the desired output, but the Price from the addons