• Resolved carver1g

    (@carver1g)


    I am using the woocommerce plugin and have a popup that opens when a customer clicks on the ‘add to cart button’ which is just a simple popup that states ‘Adding to cart – Please wait’. This keeps my impatient customers from clicking on the add to cart button repeatedly because they feel nothing is happening. I have designed the popup so the only way it closes is by redirection to the cart page upon successfully adding a product.

    This works great for my regular and variable products but need some advise for my personalized products. I hand carve names supplied by the customer into many of my wood products. For example, I sell a small cedar box which has a name field the customer fills out. This field is required and validated to be sure the customer has not left the name field empty. This validation triggers upon clicking the add to cart button. If the validation returns ‘false’ the add to cart button is then disabled until the customer corrects the problem.

    Since the popup triggers upon clicking the add to cart button, should there be a validation error, the customer is unable to correct the error and nothing is added to the cart.

    I am not using a custom selector but have this code in my functions.php:

    function custom_footer_popup_scripts() {
    ?>
    <script>
    (function ($, document, undefined) {

    $(‘#content .single_add_to_cart_button’).on(‘click’, function () {
    $(‘#popmake-1309’).popmake(‘open’);
    });
    }(jQuery, document));
    </script>
    <?php
    }
    add_action( ‘wp_footer’, ‘custom_footer_popup_scripts’ );

    I figured by using this code and not a custom selector I could maybe modify the code in some way that the popup would not trigger until the validations return ‘true’ and then the add to cart button is clicked.

    I operated ‘dinosaur’ computers while serving in the USAF during the Nam war but this new stuff has me baffled!?

    Any help will be greatly appreciated.

    https://www.ads-software.com/plugins/responsive-lightbox/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Help with add to cart woocommerce’ is closed to new replies.