[VENTURE THEME] How to change add to cart button on specific variants

Solved
Highlighted
Excursionist
23 0 5

Hey guys,
So I have a product in my store which has one variant with two options, "Installation - Yes, or No". Basically I want to set it so when installation is set to "No", it shows the add to cart button and allows customers to order it like usual, but when "Yes" is selected, it'll change to a "Contact Us" button.

I currently have a "Contact Us" button on some products, so I just wanted to set it so,

{% if variant.selected == "No" %} (I'm new to coding)

Follow by the add to cart button form, then an {% else %} with the contact us form. 
I can't help feel like I've grossly oversimplified the procedure and should be using some form of JS to make the elements change, but not sure how I'd do that. Any help would be greatly appreciated, store URL is "gslfab.com.au"

Thanks so much everyone.

0 Likes
Highlighted
Excursionist
653 116 329

please provide me that specific product page URL to know more.
- I can fulfill your requirements.... stay connected to me

2 Likes
Highlighted
Highlighted
Excursionist
653 116 329

ok wait for 5 minutes untill i prepare code for you

1 Like
Highlighted
Excursionist
653 116 329

where is the contact Us button?
if it is hidden, please make it visible

1 Like
Highlighted
Excursionist
23 0 5

The code for the contact us button can be found at Products > Engine Upgrades > ECU Remaps. The code for the button is in the page you're looking at, but it's not showing up for some reason (Hence why I'm trying to fix it).

0 Likes
Highlighted

Success.

Excursionist
653 116 329

can u add me as a staff to fix the issue?
- i have created jquery code which will solve your problem

$(document).on("change","#SingleOptionSelector-0",function(){
var label_text = $(this).parents(".selector-wrapper.js.product-form__item").find("label:eq(0)").text();
    if(label_text== "Installation"){
    var sel_val =$(this).val();
// console.log(sel_val);
 
if(sel_val == "Yes"){
         $("#AddToCart-product-template").hide();
}
else if(sel_val == "No"){
$("#AddToCart-product-template").show();
 
}
    }
});
2 Likes
Highlighted
Excursionist
23 0 5

Please reply to your private message the email you want me to send the staff access email too

0 Likes
Highlighted
Excursionist
653 116 329

yes

1 Like
Highlighted
Excursionist
23 0 5

Please send your email to gslmedia@hotmail.com

Thanks!

1 Like