I ran into an issue with WP E-commerce recently where the shipping options appeared to be unchecked every day that we went to go and look at them. Turns out it was a line in one of the shipping files that reset the shipping array to just “shipwire” which made it appear as if someone was turning off shipping every day (or a cron job, in this case).
Read about it here: https://wordpress.org/support/topic/upgrade-to-43-and-problems-with-shipping-calculator
Anyways, I created a script to monitor changes to custom_shipping_options and thereby found out what the issue was. Here’s the code, hope it helps.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
<script> Notification.requestPermission(); function notifyMe() { if (!( "Notification" in window) ) { alert("This browser does not support desktop notification"); } else if ( Notification.permission === "granted" ) { var notification = new Notification("The variable you have been monitoring has changed!"); } else if ( Notification.permission !== 'denied' ) { Notification.requestPermission(function ( permission ) { if (permission === "granted") { var notification = new Notification("The variable you have been monitoring has changed!"); } }); } } </script> <?php # Script creator: Coding Concepts / brendan@carr.ca / codingconcepts.net # This script is designed to check a variable in the WordPress Options table and notify you of changes. # Above is the html5 notification script for desktop notification immediately as it changes. # Variables $var = "custom_shipping_options"; $check1 = "fixedrate"; $check2 = "tablerate"; $email = "brendan@carr.ca"; date_default_timezone_set( 'America/Vancouver' ); $refresh_seconds = "10"; # Wordpress Stuff require( "wp-load.php" ); $test = get_option( $var ); # Debug Stuff # print_r($test); echo $test[0] . " - " . $test[1]."<BR>"; echo date( "F j, Y, g:i a" ); # If you require a single check: if ($test[0] != $check1) { if ( $test[0] != $check1 && $test[1] != $check2 ) { ?> <script> notifyMe(); </script> <?php wp_mail( $email, 'Variable Changed', 'The variable you have been monitoring has changed as of '.date("F j, Y, g:i a") ); } else { echo '<meta http-equiv="refresh" content="'.$refresh_seconds.'">'; } ?> |