boldsupport
5/27/2016 - 2:24 PM

Add this snippet to your Upsell app settings to send the messages used by bold-upsell-hide-checkout.liquid to hide the checkout / continue b

Product Upsell - Add this snippet to your Upsell app settings to send the messages used by bold-upsell-hide-checkout.liquid to hide the checkout / continue buttons until add to cart is clicked (or there is no add to cart). - linked from: https://support.boldcommerce.com/hc/en-us/articles/210861663-Hide-the-Checkout-Button-until-the-Upsell-is-Accepted

<script>
var url = location.protocol;
url = url.concat("//{your-actual-domain}.com/");
$(function() {

console.log("how many add to carts are there? ", $("[name='addtocart']").length);
if($("[name=addtocart]").length <= 0) {
window.parent.postMessage({no_add_to_cart_buttons:true}, url);
}
$("[name=addtocart]").click(function() {
  window.parent.postMessage({add_to_cart_clicked:true}, url);
});
});
</script>