-
AuthorPosts
-
January 21, 2021 at 2:27 pm #81405
Veec VeecParticipantHi, i’ve installed YITH Woocommerce Request A Quote plugin, and i did some customization on it. The product page will hide “Add to Cart” button and show “Add to Quote” for product with zero price only (RM 0.00) and will show “Add to Cart” only for price other than zero. Below is my customization code:
// Show Either Add to Cart or Add to Quote Button
add_action(‘wp_footer’,’hide_zero_add_to_cart’,10);add_action( ‘wp_ajax_flatsome_quickview’, ‘hide_zero_add_to_cart_ajax’ );
add_action( ‘wp_ajax_nopriv_flatsome_quickview’, ‘hide_zero_add_to_cart_ajax’ );function hide_zero_add_to_cart_ajax(){
?>jQuery( “.single_variation_wrap” ).on( “show_variation”, function ( event, variation ) {
if(jQuery(‘div.single_variation_wrap span.woocommerce-Price-amount.amount’).html() == ‘RM0.00′ || (jQuery(‘div.woocommerce-variation-price’).html() == “”)){
jQuery(‘.woocommerce-variation-add-to-cart.variations_button button.single_add_to_cart_button’).hide();
jQuery(‘.yith-ywraq-add-button’).show();
}else{
jQuery(‘.woocommerce-variation-add-to-cart.variations_button button.single_add_to_cart_button’).show();
jQuery(‘.yith-ywraq-add-button’).hide();
}
} )jQuery( “.single_variation_wrap” ).on( “show_variation”, function ( event, variation ) {
if(jQuery(‘div.single_variation_wrap span.woocommerce-Price-amount.amount’).html() == ‘RM0.00′ || (jQuery(‘div.woocommerce-variation-price’).html() == “”)){
jQuery(‘.woocommerce-variation-add-to-cart.variations_button button.single_add_to_cart_button’).hide();
}else{
jQuery(‘.woocommerce-variation-add-to-cart.variations_button button.single_add_to_cart_button’).show();
jQuery(‘.yith-ywraq-add-button’).hide();
}
} );<?php
}
}And when i try to install Woocommerce Multi Currency Premium, the product with zero price will show "Add To Cart" only and hide "Add To Quote" button which is not as before. Product other than zero price still show "Add To Cart" as before. Do you know why this happen? And i'm using Flatsome theme.
-
AuthorPosts
You must be logged in to see replies to this topic. Click here to login or register