display price / attributes
-
Hey!
I want to sell some prints on woocommerce and have some trouble with that. I already edited my function.php a little bit to hide prince range (on variations) and show lowest price instead://Hide Price Range for WooCommerce Variable Products add_filter( 'woocommerce_variable_sale_price_html', 'lw_variable_product_price', 10, 2 ); add_filter( 'woocommerce_variable_price_html', 'lw_variable_product_price', 10, 2 ); function lw_variable_product_price( $v_price, $v_product ) { // Product Price $prod_prices = array( $v_product->get_variation_price( 'min', true ), $v_product->get_variation_price( 'max', true ) ); $prod_price = $prod_prices[0]!==$prod_prices[1] ? sprintf(__('From: %1$s', 'woocommerce'), wc_price( $prod_prices[0] ) ) : wc_price( $prod_prices[0] ); // Regular Price $regular_prices = array( $v_product->get_variation_regular_price( 'min', true ), $v_product->get_variation_regular_price( 'max', true ) ); sort( $regular_prices ); $regular_price = $regular_prices[0]!==$regular_prices[1] ? sprintf(__('From: %1$s','woocommerce') , wc_price( $regular_prices[0] ) ) : wc_price( $regular_prices[0] ); if ( $prod_price !== $regular_price ) { $prod_price = '<del>'.$regular_price.$v_product->get_price_suffix() . '</del> <ins>' . $prod_price . $v_product->get_price_suffix() . '</ins>'; } return $prod_price; }
Is there a possibility to show the attribute of the lowest price instead of "From" > i know where to edit but i dont know how to get it...
in my case it would be "size" so it should look like "20x30: 123 €" for example.
on the product page: is it possible to show the "default attribute" instead of "size" in the menu and show its price instead of price-range (in this case "from xxx €"?
also here, if i select a size the price range is still there, is it possible to hide it?thx!!!!
mike -
interesting!
so when i set up variations, then it shows me a price range (€10-€20) instead of a "From:"
like here:
Edit:
Ah wait!the extra code you entered in your functions.php adds the "From:"
I'd say this line
$regular_price = $regular_prices[0]!==$regular_prices[1] ? sprintf(__('From: %1$s','woocommerce') , wc_price( $regular_prices[0] ) ) : wc_price( $regular_prices[0] );
should be like this (just not contain the word "From"):
$regular_price = $regular_prices[0]!==$regular_prices[1] ? sprintf(__('%1$s','woocommerce') , wc_price( $regular_prices[0] ) ) : wc_price( $regular_prices[0] );
Please be aware everytime you update lay theme your functions.php file is overwritten with the lay theme's version
-
@arminunruh said in display price / attributes:
(€10-€20)
Hey @arminunruh
yes, I edited the function.php but I didnt know that the file gets overwritten after an update....
in the overview its okay to have the price range but on the product page it actually makes no sense when i set a default size to a product. can i remove the range and only show the default price (and have the possibility to choose other sizes) without editing function.php?
when i set a default size to a product and enter the product page the price is shown, but not the size?!?!
That makes no sense, because you dont know what you pay for?!
it would be much(!!!) better if the default size is already selected and you have the possibility to choose other sizes (now there is only "SIZE" in the dropdown) -
@dingdong said in display price / attributes:
in the overview its okay to have the price range but on the product page it actually makes no sense when i set a default size to a product. can i remove the range and only show the default price (and have the possibility to choose other sizes) without editing function.php?
when i set a default size to a product and enter the product page the price is shown, but not the size?!?!
That makes no sense, because you dont know what you pay for?!Oh ok so it seems when you have set a default size, it is not set by default on the product page. Okay yea thats a bug, im going to fix it now.
Sorry for the late answer
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it