price

Custom product price suffix on based on product categories in Woocommerce

点点圈 提交于 2019-12-07 15:29:30
问题 I need to add 'per metre' to the price on most of my online catalogue, I tried the code on this thread in my finctions.php but I cannot get it to omit/include particular categories- it seems to be all or nothing. What am I doing wrong? I have edited the code as such: /*add 'per metre' after selected items*/ add_filter( 'woocommerce_get_price_html', 'conditional_price_suffix', 20, 2 ); function conditional_price_suffix( $price, $product ) { // HERE define your product categories (can be IDs,

Display the default variation price and savings amount on Woocommerce 3

两盒软妹~` 提交于 2019-12-06 11:54:13
I need to display default variation price & with regular price & savings amount on my Woocommerce Homepage & Category Page I found following code on this links answer Display lowest variation price and discounted percentage in WooCommerce add_filter( 'woocommerce_get_price_html', 'custom_price_format', 10, 2 ); add_filter( 'woocommerce_variable_price_html', 'custom_price_format', 10, 2 ); function custom_price_format( $price, $product ) { // Main Price $regular_price = $product->is_type('variable') ? $product->get_variation_regular_price( 'min', true ) : $product->get_regular_price(); $sale

Display price on add to cart button from the functions.php file in Woocommerce

萝らか妹 提交于 2019-12-06 11:04:23
Been trying to find something about this, but the solutions I found so far here do not work. I need, in the single product page, to display the add to cart button like this: ADD TO CART - JUST $PRICE It needs to be done from the functions.php file in the child theme. Thanks a lot! To handle the display of the product price in add-to-cart button for all product prices on shop, other archives pages and single product pages, without any need of overriding templates , using dedicated Woocommerce filter hooks: add_filter( 'woocommerce_product_add_to_cart_text', 'custom_add_to_cart_price', 20, 2 );

Add a custom text before the price display in WooCommerce

不打扰是莪最后的温柔 提交于 2019-12-06 10:04:27
In WooCommerce, I'm using this code to put a text in the price display: function cw_change_product_price_display( $price ) { $price .= ' TEXT'; return $price; } add_filter( 'woocommerce_get_price_html', 'cw_change_product_price_display' ); add_filter( 'woocommerce_cart_item_price', 'cw_change_product_price_display' ); The page displays like "$99,99 TEXT" I want to make it displays like this: "TEXT $99,99" Thank you for the help. You have just to inverted the price and the text: add_filter( 'woocommerce_get_price_html', 'cw_change_product_price_display' ); add_filter( 'woocommerce_cart_item

Add a multilingual text after price in woocommerce_get_price_html hook

大憨熊 提交于 2019-12-06 08:38:38
I am building an WooCommerce website and customizing it, copying and pasting code from internet libraries. I have managed to add "custom price and custom text" in woocommerce product so they can be translated into different languages. Here is the look of the product page: https://www.primacent.de/de/product/woo-album-3-2 Here is my code in functions.php : //New Price add_action('woocommerce_product_options_pricing','custom_unit_price'); function custom_unit_price() { woocommerce_wp_text_input( array( 'id' => '_unit_price', 'class' => 'wc_input_price short', 'label' => __( 'Unit Price',

Adding custom text labels to the product prices depending on their type

你。 提交于 2019-12-06 08:38:15
I have one little problem that I can't solve yet. I have this WooCommerce web site with variable products, and currently prices are shown in this way: $5.50 per dozen – $100.00 per dozen I use this CSS rule that adds "per dozen" after every price, but that dont make sense in the current scenario. .price .amount:after { content: " per dozen"; } I would like to show the prices on this variable products this way: $5.50 per dozen – $100.00 per case (quantity number) Thanks in advance for any help. LoicTheAztec Here you are going to be able to add custom labels just as you want using a custom

Enable sale price for logged users and regular price for unlogged users in Woocommerce

放肆的年华 提交于 2019-12-06 08:20:43
In Woocommerce I have a variable products with many variations and every variation has its own REGULAR price and SALE price. I would like when user: is logged in, the sale price will be the active price is not logged in, the regular price will be the active price. I have added this hooked function in my child theme function.php file: add_filter( 'woocommerce_available_variation', 'my_variation', 10, 3); function my_variation( $data, $product, $variation ) { wc_delete_product_transients($variation->get_id()); $variation_id = $variation->get_id(); $variable_product1= new WC_Product_Variation(

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

跟風遠走 提交于 2019-12-06 05:37:35
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? Updated: You should try the following revisited function code: add_filter( 'woocommerce_get_price_html', 'prepend_text_to_product_price', 20, 2 ); function prepend_text_to_product_price(

Hide product prices and add-to-cart buttons but not variations for unregistered users in WooCommerce

£可爱£侵袭症+ 提交于 2019-12-06 03:20:55
In my WooCommerce shop I want to hide the prices until the customer has logged in. I've got the following code working that does exactly that: add_action('init','hide_price'); function hide_price(){ if(!is_user_logged_in()){ remove_action('woocommerce_after_shop_loop_item','woocommerce_template_loop_add_to_cart',10); remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart',30); remove_action('woocommerce_single_product_summary','woocommerce_template_single_price',10); remove_action('woocommerce_after_shop_loop_item_title','woocommerce_template_loop_price',10

Custom product price suffix on based on product categories in Woocommerce

吃可爱长大的小学妹 提交于 2019-12-05 20:04:35
I need to add 'per metre' to the price on most of my online catalogue, I tried the code on this thread in my finctions.php but I cannot get it to omit/include particular categories- it seems to be all or nothing. What am I doing wrong? I have edited the code as such: /*add 'per metre' after selected items*/ add_filter( 'woocommerce_get_price_html', 'conditional_price_suffix', 20, 2 ); function conditional_price_suffix( $price, $product ) { // HERE define your product categories (can be IDs, slugs or names) $product_categories = array('fabric','haberdashery', 'lining',); if( ! has_term(