Skip to content

California Prop 65 conditional text in WooCommerce

If you’re shipping products subject to Proposition 65 rules to addresses in California you’ll need to display text accordingly upon checkout. Surprisingly as of February 2021 we could find no working code or plugin that correctly displayed a message for an individual state.

We created the below code to display a WooCommerce warning message when shipping to CA addresses. The code will check for the “Ship to a different address” checkbox and act accordingly. It also handles saved addresses on logged in accounts.

We recommend adding this code to a custom site functionality plugin (opens in a new tab), but it can also be added to a child theme’s functions.php file.

Partially based on code from emartmedia.com (opens in a new tab).

https://gist.github.com/razorfrog/989a14c97317de665e661a96bffb765b

Categories: Code
A black silhouette of a frog viewed from above, showing its outstretched legs and toes.
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Please visit our privacy policy for more information regarding the personally identifiable information we collect and how it is used.