How can I update the price when someone enters postcode or zip code in woocommerce checkout page?

As I was trying to add some additional amount to my charge and I was unable to update the charge amount. The code which I was trying was this using AJAX call: $woocommerce->cart->set_total($woocommerce->cart->total + $additional_amount); But the real problem was with my payment method, not the cart price. So, I resolved it using a filter … Read more

REST API custom endpoint to fetch pages and posts not working

First off, there’s a default endpoint for retrieving pages, but I presumed that you intentionally did not use it? Now the issues with your code: That $request->get_params() gets all the parameters and not a single one. So for single parameters, you should use $request->get_param(). $slug = $request->get_params(‘slug’); // incorrect $slug = $request->get_param( ‘slug’ ); // … Read more

Generating 3 random numbers and saving them in database

date_default_timezone_set(‘GMT’); $today = date(‘H:i’); for($i=1; $i<=365; $i++) { $repeat = strtotime(“+1 day”,strtotime($today)); $today = date(‘g:i a’,$repeat); } $date1 = date(“1:09 a”); //IMPORTANT: This must be at the top of your page1.html before anything is sent to browser! if($today==$date1){ $random1 = rand(00,99); $random2 = rand(00,99); $random3 = rand(00,99); $randate1 = date(‘Y-m-d’); $link = mysqli_connect(“localhost”, “funlotto”, “5K39S3p2!g”, … Read more