Forum Replies Created
-
AuthorPosts
-
Hi Harry,
started working but not correct amounts added to cart, when I click 0 and 0 add to cart, 1 and 0 or 1 and 1 product combinations is shows added 2 and 2 of each product.
When I add 1 and two it ads 2 and 3 and so on always 1 more the I chose. please see attached
Attachments:
You must be logged in to view attached files.thank you!
by the way I tested more WooCommerce Force Default Variant plugin and it is not good as it doesn’t actually make variant chosen of the first page loading, so I think it is better to set up default variation to all products or if you have time maybe you can have a look at the code below but at the moment I tested and it didn’t work. https://gist.github.com/deepzak/35f579d6f9545e262d36
Hi Harry,
I have one additional question to the code above to remove the price range, which works as I have been recommended to add this part of code && is_product()) to show it only on product page but not on loop, but I noticed that the price range still appears on quick view, is it possible to hide it from quick view too?
or is quick view same page as product page?
What I mean is can i add rule to this condition on line 14 if && is_product()) and not quick view somehow
Thank you
Above code works best with this plugin to always show price on variable product page
Thank you I will add new code in the end now!
OK I will create separate topic for every question.
I have found the solution for question 15 if you want to use it in Claue
It shows range price on category and shows single prices for variable products without range price even if all variations are the same price. Also moves variations price above variations to keep same template for all products which allow to use hooks below the price.
//Move Variations price above variations to have the same template even if variations prices are the same
remove_action( ‘woocommerce_single_variation’, ‘woocommerce_single_variation’, 10 );
add_action( ‘woocommerce_before_variations_form’, ‘woocommerce_single_variation’, 10 );//Remove Price Range
add_filter( ‘woocommerce_variable_sale_price_html’, ‘detect_variation_price_format’, 10, 2 );
add_filter( ‘woocommerce_variable_price_html’, ‘detect_variation_price_format’, 10, 2 );function detect_variation_price_format( $price, $product ) {
// Main Price
$prices = array( $product->get_variation_price( ‘min’, true ), $product->get_variation_price( ‘max’, true ) );
if ($prices[0] !== $prices[1] && is_product()) {
$price = $prices[0] !== $prices[1] ? sprintf( __( ”, ‘woocommerce’ ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
}
return $price;
}This reply has been marked as private.This reply has been marked as private.3 Actually, I don’t know what it the issue with your demo products but when I created new product /product/test-layout-1-right/ it all the time shows quick view button in single line!
I can also suggest you to add in custom javascript in sample data the code below, it will move email (create and account) section on top of billing which I think make more sense) I applied it on my checkout.
jQuery(‘.woocommerce-account-fields’).insertBefore(‘.woocommerce-billing-fields’);
jQuery(‘.woocommerce-checkout .validate-email’).prependTo(‘.woocommerce-account-fields’);13. Also I found answer to my question 13, so will try to edit styles myself where I can with yellow pencil plugin, I think you can recommend it with your theme as will be much less questions about how to style everything that is related to colours and text!
14 on this template with linked products product/men-clothing-combo/
how can I move Earn 6 Points when purchase this product. Worth £0.06! notice below the cart button as everywhere else?
15 I found also how to remove variable price range below, but it also removes it fron loop, the author said I need to put code inside if ( is_product() ) { } but when I do that it stops hiding from product page, could you please let me know which code I should put it into to work only on product page not on loop?
if ( is_product() ) {
//Remove Price Range
add_filter( ‘woocommerce_variable_sale_price_html’, ‘detect_variation_price_format’, 10, 2 );
add_filter( ‘woocommerce_variable_price_html’, ‘detect_variation_price_format’, 10, 2 );
} -
AuthorPosts