admin管理员组文章数量:1316980
Need help here please. I am trying to hide the 'add to cart' woocommerce button when a user selects a specific item in a dropdown list. I have tried multiple JQuery snippets in both functions.php and through 3rd party plugins but am still struggling to get it to work.
In Functions.php theme file
function load_scripts() {
?>
<script type="text/javascript">
$(document).ready(function(){
$(document.getElementsByName("select-1574795073993")).change(function(){
$( "select option:selected").each(function(){
if($(this).attr("value")=="International"){
$(".single_add_to_cart_button").hide();
}
});
}).change();
});
</script>
<?php
}
add_action('wp_enqueue_scripts', 'load_scripts');
Please can someone assist with simple steps to 1) provide correct code, and 2) insert in the woocommerce hosted plarform.
Much appreciated!
本文标签: functionsHide 39add to cart39 when certain value in dropdown is selected
版权声明:本文标题:functions - Hide 'add to cart' when certain value in dropdown is selected 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742004498a2411683.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论