Answers for "add view cart button after added to cart on single ppage"

0

add view cart button after added to cart on single ppage

add_action('wp_footer','custom_jquery_add_to_cart_script');
function custom_jquery_add_to_cart_script(){
    if ( is_shop() || is_product_category() || is_product_tag() ): // Only for archives pages
        ?>
            <script type="text/javascript">
                // Ready state
                (function($){ 

                    $( document.body ).on( 'added_to_cart', function(){
                        console.log('EVENT: added_to_cart');
                    });

                })(jQuery); // "jQuery" Working with WP (added the $ alias as argument)
            </script>
        <?php
    endif;
}
Posted by: Guest on May-31-2021

Code answers related to "add view cart button after added to cart on single ppage"

Browse Popular Code Answers by Language