This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * Save current single product to cookies | |
| * To display those products in single product 'Recentrly searched' section | |
| */ | |
| add_action('wp', 'matat_save_current_single_product_to_cookies'); | |
| function matat_save_current_single_product_to_cookies() { | |
| if( get_field('recently_viewed_cookie_num', 'options') ) { | |
| $number_of_products = get_field('recently_viewed_cookie_num', 'options'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function woocommerce_add_to_cart_variable_rc_callback() { | |
| ob_start(); | |
| $product_id = apply_filters( 'woocommerce_add_to_cart_product_id', absint( $_POST['product_id'] ) ); | |
| $quantity = empty( $_POST['quantity'] ) ? 1 : apply_filters( 'woocommerce_stock_amount', $_POST['quantity'] ); | |
| $variation_id = $_POST['variation_id']; | |
| $variation = $_POST['variation']; | |
| $passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'wp_ajax_wordpress_ajax_action_name', 'wordpress_ajax_action_name' ); | |
| add_action( 'wp_ajax_nopriv_wordpress_ajax_action_name', 'wordpress_ajax_action_name' ); | |
| function wordpress_ajax_action_name(){ | |
| echo 'test :)'; | |
| wp_die(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $( 'body' ).on( 'click', '.my_ajax_btn', function(e){ | |
| e.preventDefault(); | |
| var first_name = 'Guy'; | |
| var last_name = 'Ytzhak'; | |
| var role = 'CEO'; | |
| jQuery.ajax({ | |
| url: sp_ajaxify.ajax_url, |
NewerOlder