price

WooCommerce variable products: keep only “min” price with a custom label

随声附和 提交于 2019-11-27 04:53:06
问题 In the functions file I have added a filter hook to add a custom label before the variation product "min" price. How can I get the label in the same line as the price? See my code and the screenshot below: add_filter( 'woocommerce_variable_sale_price_html', 'wc_wc20_variation_price_format', 10, 2 ); add_filter( 'woocommerce_variable_price_html', 'wc_wc20_variation_price_format', 10, 2 ); function wc_wc20_variation_price_format( $price, $product ) { $min_price = $product->get_variation_price(

Replace WooCommerce variable products price range with 'Up to' and the max price

自作多情 提交于 2019-11-26 23:40:27
问题 I found the following code (from here) which enables me to show on a variable price product on WooCommerce: ' From: £10 ' (on a £10 - £50 product). I would like to effectively reverse this and show ' Up to: £50 '. I have tried to tweak the code below, but just can't figure it out: function custom_variable_price_range( $price_html, $product ) { $prefix = sprintf('%s: ', __('From', 'woocommerce') ); $min_regular_price = $product->get_variation_regular_price( 'min', true ); $min_sale_price =

Add a checkbox on single product pages that adds an additional cost in Woocommerce

自作多情 提交于 2019-11-26 21:46:21
问题 In woocommerce, I am using the following code to display an input text field on admin product edit pages, that allow me to add an additonal pricing option to the product: add_action( 'woocommerce_product_options_pricing', 'wc_cost_product_field' ); function wc_cost_product_field() { woocommerce_wp_text_input( array( 'id' => 'repair_price', 'class' => 'wc_input_price short', 'label' => __( 'Repair Cost', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')' ) ); } add_action( 'save

Change product prices via a hook in WooCommerce 3

最后都变了- 提交于 2019-11-26 19:06:43
IN WooCommerce, I need to multiply all product prices by a number. So I have used the following (via a plugin) : add_filter('woocommerce_get_regular_price', array( $this, 'my_custom_price'), 99); add_filter('woocommerce_get_price', array( $this, 'my_custom_price'), 99); function my_custom_price( $original_price ) { global $post, $woocommerce; //Logic for calculating the new price here $new_price = $original_price * 2; //Return the new price (this is the price that will be used everywhere in the store) return $new_price; } But, that doesn't work for variation products. I have tried the

Move the variation price location in WooCommerce

你说的曾经没有我的故事 提交于 2019-11-26 17:25:50
问题 I'm have started building an e-shop in Wordepress with WooCommerce plugin. I added some products with variations and I noticed that the price is displayed after attributes select fields. Is it possible to move the price between Title and short description as for simple products? The url of one product is: http://www.roubinisideas.com/test2/product/uncategorized/vintage/ 回答1: Update (on September 2019) : Avoiding availability repetitions (bug solved on 2018) Keep other product types unchanged

Replace price range handling default variation displayed price in Woocommerce 3

廉价感情. 提交于 2019-11-26 17:08:47
问题 On our woocommerce website I am trying to update the displayed price based on the variations the customer selects from dropdown menus as shown here: I used a php function that had been submitted in another answer by LoictheAztec: Replace the Variable Price range by the chosen variation price in WooCommerce 3 add_action( 'woocommerce_before_single_product', 'move_variations_single_price', 1 ); function move_variations_single_price(){ global $product, $post; if ( $product->is_type( 'variable' )

Change product prices via a hook in WooCommerce 3

ⅰ亾dé卋堺 提交于 2019-11-26 07:42:30
问题 IN WooCommerce, I need to multiply all product prices by a number. So I have used the following (via a plugin) : add_filter(\'woocommerce_get_regular_price\', array( $this, \'my_custom_price\'), 99); add_filter(\'woocommerce_get_price\', array( $this, \'my_custom_price\'), 99); function my_custom_price( $original_price ) { global $post, $woocommerce; //Logic for calculating the new price here $new_price = $original_price * 2; //Return the new price (this is the price that will be used