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.
<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.'">';
}
?>