Search
 
SCRIPT & CODE EXAMPLE
 

PHP

run php after product added

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;
}
Comment

PREVIOUS NEXT
Code Example
Php :: update query in laravel eloquent 
Php :: evaluate home tilde ~ in php 
Php :: New in initializers - PHP 8.1 
Php :: Ajouter du contenu personnalisé sous chaque article/publication WordPress 
Php :: post with count greater than 1 laravel 
Php :: relationship on the base of condition in laravel 
Php :: ussd php 
Php :: php how to split square bracket and normal sting in a word or sentence 
Php :: PHP include causes white space at the top of the page 
Php :: laravel collection median 
Php :: wordpress give query a unique identity 
Php :: Limiter la révision des articles WordPress 
Php :: php print keys of array 
Php :: laravel validation on gropu route 
Php :: laravel Error: Unsupported operand types: IlluminateDatabaseEloquentCollection - int 
Php :: php accounting ledger 
Php :: Terminfo file does not exist. tinker larvel 
Php :: laravel login register api 
Php :: pluck only category name and id from model in laravel 
Php :: php sum 2 arrays 
Php :: php artisan vendor:publish aborted 
Php :: symmetric decryption in php 
Php :: PHP (php 7.3.5) sample 
Php :: how to select and deselect all items without use name in laravel 
Php :: how to validate multi image upload in laravel 
Php :: php convert datetime to timestamp 
Php :: laravel eloquent order by relationship 
Php :: PHP strcspn — Find length of initial segment not matching mask 
Php :: multipart json test laravel 
Php :: php group subarrays by column key 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =