WooCommerce - excelling eCommerce
Custom shipping add-on shows Fatal error: Class 'WC_Shipping_Method' not found (3 posts)

  1. DanielHolm
    Posted 1 year ago #


    I'm creating a custom shipping add-on for WooCommerce to have the shipping price based on amount of articles in cart.

    The add-on is almost done, and I've followed WooCommerce's docs to create it, and copied some from the Flat Rate shipping class.

    Now, I cant get it to work as an add-on, but if I put the code in functions.php in my theme it works.

    When having it as a seperate wp-plugin the site crashes and error-log shows:
    PHP Fatal error: Class 'WC_Shipping_Method' not found in /var/www/wp-content/plugins/class-wc-shipping-per-product/class-wc-shipping-per-product.php on line 43

    Code of class-wc-shipping-per-product.php: http://pastebin.com/rrhxzaSw


  2. ronaldfuquay
    Posted 1 year ago #

    I am having the exact same situation with my site, if I find anything out I will post it here.

  3. sp4cecat
    Posted 1 year ago #

    If you haven't already tracked it down, WooCommerce has updated the shipping plugins instructions to get you to wrap a function around your shipping class, and hook it to WooCommerce init:


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic