In my WordPress project, I am working on a customization where the add to cart button on the product page should remain hidden until the customer answers all the questions. The plugin I am using offers options for the customers to select, such as Step 1, Step 2, Step 3, etc. Once they reach the last step, the "Continue" button is deactivated and its class changes to .owl-next button disabled.
I want to use this class as a trigger to display the add to cart button only when it becomes active, and hide it otherwise. Currently, I have been successful in hiding the add to cart button, but I am facing difficulties in making it appear when required. Below are the codes I have experimented with so far:
<script>
var aVisible = $('.owl-next.button').css('display');
if (aVisible == 'none') {
}
</script>
<script>
if($('.owl-next.button').length){
$('.single_add_to_cart_button.button.alt').hide();
}
</script>
<div class="owl-nav"><a class="owl-prev button">Back</a><a class="owl-next button disabled">Continue</a></div>
<button type="submit" name="add-to-cart" value="267" class="single_add_to_cart_button button alt">Add to cart</button>
Changes made on the last step:
<div class="owl-nav"><a class="owl-prev button">Back</a><a class="owl-next button disabled">Continue</a></div>
<button type="submit" name="add-to-cart" value="267" class="single_add_to_cart_button button alt">Add to cart</button>