Home › Forums › Themes Support › Claue › Main issue with main price under title & a few other problems
- This topic has 1 reply, 2 voices, and was last updated 5 years, 7 months ago by Harry.
-
AuthorPosts
-
-
September 20, 2018 at 6:58 pm #24875
I have got three issues and hopefully we can get it resolved.
- This is only for the VARIATIONS. The [from to price] under the title, needs to change as soon as someone selects something from the dropdown, rather then displaying below the dropdown.
Currently it is like this: https://mcrcctvsuppliers.nl/product/hikvision-ds-7216hqhi-k2-2mp-16-channel-dvr/
But I want it like this: https://www.cctvkits.co.uk/oyn-x-2-x-2mp-wireless-cctv-kit-1tb.htmlIf this is not possible, can that price for variation stay hidden and as soon as someone selects anything from the dropdown it will be displayed there? - This is only for the VARIATIONS. So basically I have displayed the main price as EX VAT and underneath it shows INC VAT (through suffix). We have used a plugin to set prices for user roles. So when you login and look at the item. Both prices show INC VAT. You can test with username pr & password JanStudioTest12. Use the same or any other item to test: https://mcrcctvsuppliers.nl/product/hiwatch-116g-f1-2mp-hybrid-16-channel-dvr/
- Filter sidebar: On some pages it shows different from & to price: https://mcrcctvsuppliers.nl/product-category/recorders/dvr/
- Filter sidebar: If you are logged in with any account and go for example to this page: https://mcrcctvsuppliers.nl/product-category/cameras/hybrid/ You will see that the price is stuck on £22-£22.
You can test with username pr & password JanStudioTest12
- Log out section: When you log out as a customer, it redirects the website to the standard WP-Login.php and takes few steps to completely logout a customer. After that it stays on that page as well. Can we in a way make it happen that when they press Log out, it just logs out and lands on homepage or any page saying, you are logged out? Rather then being taken away from the website?
Please keep in mind that the issues related to login are for customer logins, not admins. Therefore I created another user role account to test the issues: username pr & password JanStudioTest12
- This is only for the VARIATIONS. The [from to price] under the title, needs to change as soon as someone selects something from the dropdown, rather then displaying below the dropdown.
-
September 20, 2018 at 10:23 pm #24887
Hi,
1,2. Please add below code to claue-child > functions.php
// Utility function to get the default variation (if it exist) function get_default_variation( $product ){ $attributes_count = count($product->get_variation_attributes()); $default_attributes = $product->get_default_attributes(); // If no default variation exist we exit if( $attributes_count != count($default_attributes) ) return false; // Loop through available variations foreach( $product->get_available_variations() as $variation ){ $found = true; // Loop through variation attributes foreach( $variation['attributes'] as $key => $value ){ $taxonomy = str_replace( 'attribute_', '', $key ); // Searching for a matching variation as default if( isset($default_attributes[$taxonomy]) && $default_attributes[$taxonomy] != $value ){ $found = false; break; } } // If we get the default variation if( $found ) { $default_variaton = $variation; break; } // If not we continue else { continue; } } return isset($default_variaton) ? $default_variaton : false; } add_action( 'woocommerce_before_single_product', 'move_variations_single_price', 1 ); function move_variations_single_price(){ global $product, $post; if ( $product->is_type( 'variable' ) ) { // removing the variations price for variable products remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); // Change location and inserting back the variations price add_action( 'woocommerce_single_product_summary', 'replace_variation_single_price', 10 ); } } function replace_variation_single_price(){ global $product; // Main Price $prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) ); $active_price = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); // Sale Price $prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) ); sort( $prices ); $regular_price = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); if ( $active_price !== $regular_price && $product->is_on_sale() ) { $price = '<del>' . $regular_price . $product->get_price_suffix() . '</del> <ins>' . $active_price . $product->get_price_suffix() . '</ins>'; } else { $price = $regular_price; } // When a default variation is set for the variable product if( get_default_variation( $product ) ) { $default_variaton = get_default_variation( $product ); if( ! empty($default_variaton['price_html']) ){ $price_html = $default_variaton['price_html']; } else { if ( ! $product->is_on_sale() ) $price_html = $price = wc_price($default_variaton['display_price']); else $price_html = $price; } $availiability = $default_variaton['availability_html']; } else { $price_html = $price; $availiability = ''; } // Styles ?> <style> div.woocommerce-variation-price, div.woocommerce-variation-availability, div.hidden-variable-price { height: 0px !important; overflow:hidden; position:relative; line-height: 0px !important; font-size: 0% !important; } </style> <?php // Jquery ?> <script> jQuery(document).ready(function($) { var a = 'div.wc-availability', p = 'p.price'; $('select').blur( function(){ if( '' != $('input.variation_id').val() ){ if($(a).html() != '' ) $(a).html(''); $(p).html($('div.woocommerce-variation-price > span.price').html()); $(a).html($('div.woocommerce-variation-availability').html()); } else { if($(a).html() != '' ) $(a).html(''); $(p).html($('div.hidden-variable-price').html()); } }); }); </script> <?php echo '<p class="price">'.$price_html.'</p> <div class="wc-availability">'.$availiability.'</div> <div class="hidden-variable-price" >'.$price.'</div>'; }
3. This issue of plugin it doesn’t option switch filter by price as sort price from high to low (WooCommerce issue)
4. This issue cause by plugin “WooCommerce Prices By User Role”
5. Please use plugin https://wordpress.org/plugins/login-and-logout-redirect/
Kind regards
Harry
Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio
-
-
AuthorPosts
You must be logged in to reply to this topic.