For some Crime De-Coder news, I will be giving a tech talk on automated license plate readers for the Wake County Libertarian Party on Wednesday July 17th in Raleigh.

See my slides on the CRIME De-Coder website to get a preview of what I will be talking about.
This post will just be a quick one that is hopefully helpful to others. So I use WooCommerce + LuLu to distribute shipping for my print book. For those who have purchased a copy thank you! Many of the paperback purchases will be arriving at your homes very soon. There have been two hiccups with my store website for individuals.
Problem 1 is an error nonce is invalid popping up after trying to add the book to the cart. It is difficult to replicate and is an underlying cache error with WordPress as best I can tell. My advice to fix is go to the individual book page directly to add the book to your cart (paperback, ebook). It seems to mostly happen to me when I am on the main shop page and add directly to cart. If the problem persists for you let me know.
The second problem is that for the print book, to do shipping on LuLu’s end you need to input a phone number. As far as I can tell, most website advice in WooCommerce suggest to pay for an additional plug in to edit this option. I was able to use javascript (and the WPCode free plugin) though to force the phone number to be filled in for free though. Sharing here as I hope it will be helpful to others.
Check out the onload function first, that sets the attribute for either billing-phone or shipping-phone to be required. If you are fast and are looking at the exact right spot of the checkout page, you would be able to see this change from “Phone (Optional)” to “Phone”.
The change_label event listener is to modify the error message when you don’t put in a phone number (by default it confusingly says “Please enter a valid phone number (optional)”. So that part is a bit hacky with attaching the event listener to the entire webpage, but unless you are trying to purchase from a Commodore 64 it should be fine.
<script>
// This script forces the billing/shipping
// phone number to be filled in and not optional
// Andy Wheeler, done via WPCode Extension in Footer
function change_label(){
var xl = document.getElementById("billing-phone");
if (xl){
var ll = xl.nextSibling;
var nd = ll.nextSibling;
if (nd) {
if (nd.getAttribute('role') == 'alert') {
nd.firstChild.innerText = "Please enter a valid phone number"
};
};
};
var xs = document.getElementById("shipping-phone");
if (xs){
var ls = xs.nextSibling;
var ns = ls.nextSibling;
if (ns) {
if (ns.getAttribute('role') == 'alert') {
ns.firstChild.innerText = "Please enter a valid phone number"
};
};
};
};
// So click is not working when people
// just use tabs/keyboard select
// not sure how to fix that, but just results in a
// bad red note that says "optional" (but still need
// to fill in
document.addEventListener('click',change_label);
window.onload = function() {
var x = document.getElementById("billing-phone");
if (x) {
var lab = x.nextSibling;
lab.innerText = "Phone";
x.setAttribute('aria-label','Phone')
x.setAttribute('required','')
// These don't seem to work unfortunately!
//x.addEventListener("change",change_label);
//x.setAttribute("onChange","change_label();")
};
var x2 = document.getElementById("shipping-phone");
if (x2) {
var lab2 = x2.nextSibling;
lab2.innerText = "Phone";
x2.setAttribute('aria-label','Phone')
x2.setAttribute('required','')
};
};
</script>
Because there is no phone verification, you could technically put in a fake number for these FYI and no one would know. (I have a google voice number I use for instances in which I don’t really want to give out personal.)
Thanks again for those who have purchased a copy – appreciate the support.


