Razorfrog Web Design Razorfrog Web Design
  • Home
  • About
  • Services
    • Responsive Web Design
    • E-Commerce Stores
    • Logo & Brand Identity
    • Search Engine Optimization
    • Copywriting & Editing
    • Photography & Imaging
  • Portfolio
  • News
  • Contact
Close
  • Home
  • About
  • Services
    • Responsive Web Design
    • E-Commerce Stores
    • Logo & Brand Identity
    • Search Engine Optimization
    • Copywriting & Editing
    • Photography & Imaging
  • Portfolio
  • News
  • Contact

California Prop 65 Conditional Text in WooCommerce

February 25, 2021

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, but it can also be added to a child theme’s functions.php file.

Partially based on code from emartmedia.com.

Posted in: Code Author: Vinicius Miazaki

Share

FacebookTwitter

4 Comments

  1. Avatar of Stavros Mitchelides
    Stavros Mitchelides
    November 24, 2021 at 10:37 pm / Reply

    Hi, I’ve tried adding this snippet 4 times but it never appears no matter how many times I change the cart to an address California?

    • Avatar of Max Elman
      Max Elman
      February 22, 2022 at 2:51 pm /

      Hi Stavros – We’ve tested with current WooCommerce versions and it’s still working fine. Perhaps a caching issue for you?

  2. Avatar of nathan
    nathan
    January 11, 2022 at 6:30 pm / Reply

    Hello! I am looking at your Prop 65 Code for Woocommerce, and it appears that the warning does not currently pop up when I select a billing state that is not CA and the select “Ship to a Different Address” then enter a CA address.

    It does show up if I refresh the page with the addresses filled out, and it does work just fine for Billing State, just not initially. We definitely need it to show up for both if possible. Any ideas?

    Thanks in advance for your help!

    • Avatar of Max Elman
      Max Elman
      February 22, 2022 at 2:57 pm /

      Hi Nathan – I just tested both scenarios you described on a clean WooCommerce install and it works for both.

Leave a Reply / Cancel Reply

  • Prev
  • Next

© 2008-2023 RAZORFROG WEB DESIGN
Sitemap • Terms of Service • Privacy • Cookie Policy • Accessibility
415-480-4587 • 1032 Irving St #984
, San Francisco, CA 94122
Powered by WordPress