AWD Weight/Country Shipping for WooCommerce
Duplicating a plugin for another shipping method (7 posts)

  1. marjel
    Posted 3 years ago #

    great great plugin! :-)

    Could you please please make a duplicate (or tell me what to change) so it can be used it for another (similar) shipping method.

    I saw PozHonks said:

    You will have to duplicate the plugin by changing its name (e.g.: awd2.php) and names of some other functions to avoid conflicts.

    it would be super great if someone could do it for the rest of us sheep.

    All the best to you

    p.s. it may be relatively easy for you, but is super hard for me (I tried for several weeks and still no success because of my stupid "trial and error" method) :-/


  2. demon11c
    Posted 2 years ago #

    Im also interested in something like this. I posted here before I saw this thread. I wonder if someone got the duplicate working...

  3. demon11c
    Posted 2 years ago #

    I duplicated shipping-awd.php and tried to enable it on the plugins page, but got the following fatal error:

    Fatal error: Cannot redeclare init_awd_shipping() (previously declared in awd-weightcountry-shipping/shipping-awd.php:28) in awd-weightcountry-shipping/shipping-awd_ems.php on line 296

    Any idea what I can try?

  4. demon11c
    Posted 2 years ago #

    I was able to enable the second instance by replacing init_awd_shipping with a unique entry (init_awd_shipping_2) but I cant see the new instance under the shipping tab in WooCommerce.

    Im totally going blind here. Please add if you have any ideas...

  5. demon11c
    Posted 2 years ago #

    Ok so I just noticed yet another thread with the same topic.

    Apologies for my duplication of threads.

    But would be nice to hear from anyone if they managed to make this work. Or if this may be in a future official release. Thank you.

  6. demon11c
    Posted 2 years ago #

    Sorry for the bump. Anyone have an idea on how to do this?

  7. ce2mla
    Posted 2 years ago #

    I believe I have the duplicate version working, though its more of a quick fix that a solution:

    • duplicated the shipping-awd.php and renamed the duplicate shipping-awd-2.php

    • opened the file and did a find a replace ALL 'awd_shipping' => 'awd_shipping_2' to make them unique.

    • updated the tile on lines 3,35,37 - 'AWD Weight/Country' => 'AWD Weight/Country (awd_shipping_2)' this is just to help differentiate between them.


    I've repeated this 6 times for different postage classes (1st class, 2nd class, next day etc...), each time just updating the pending number to keep each version unique, seems to work so far in my tests.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • AWD Weight/Country Shipping for WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic