|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | // WooCommerce - Selects the best-fitting shipping box using BoxPacker (https://github.com/dvdoug/BoxPacker) for a WooCommerce order based on item dimensions and weight, and displays this information in the order details |
4 | | -// Last update: 2025-09-28 |
| 4 | +// Last update: 2025-12-27 |
5 | 5 |
|
6 | 6 |
|
7 | 7 | // Add best package fit inside WooCommerce orders using a custom field - run action once (run on WP Console) |
|
20 | 20 | // } |
21 | 21 |
|
22 | 22 |
|
23 | | -// Requires BoxPacker 4.1.1 (https://github.com/dvdoug/BoxPacker) to be installed in the "wp-content" folder (no Composer needed) |
24 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/Box.php'; |
25 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/BoxList.php'; |
26 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/BoxSorter.php'; |
27 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/DefaultBoxSorter.php'; |
28 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/Item.php'; |
29 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/ItemList.php'; |
30 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/ItemSorter.php'; |
31 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/DefaultItemSorter.php'; |
32 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/LayerPacker.php'; |
33 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/LayerStabiliser.php'; |
34 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/OrientatedItem.php'; |
35 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/OrientatedItemFactory.php'; |
36 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/OrientatedItemSorter.php'; |
37 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/PackedBox.php'; |
38 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/PackedBoxList.php'; |
39 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/PackedBoxSorter.php'; |
40 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/DefaultPackedBoxSorter.php'; |
41 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/PackedItem.php'; |
42 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/PackedItemList.php'; |
43 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/PackedLayer.php'; |
44 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/Packer.php'; |
45 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/Rotation.php'; |
46 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/VolumePacker.php'; |
47 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/WeightRedistributor.php'; |
48 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/WorkingVolume.php'; |
49 | | -require_once WP_CONTENT_DIR . '/boxpacker/src/Exception/NoBoxesAvailableException.php'; |
50 | | -// require_once WP_CONTENT_DIR . '/boxpacker/tests/Test/TestBox.php'; |
51 | | -// require_once WP_CONTENT_DIR . '/boxpacker/tests/Test/TestItem.php'; |
| 23 | +// Requires BoxPacker 4.1.1 (https://github.com/dvdoug/BoxPacker) installed via Composer: |
| 24 | +// cd /home/website.com/public_html/wp-content/ |
| 25 | +// composer require dvdoug/boxpacker |
| 26 | +require_once WP_CONTENT_DIR . '/vendor/autoload.php'; |
52 | 27 |
|
53 | 28 | use DVDoug\BoxPacker\Box; |
54 | 29 | use DVDoug\BoxPacker\DefaultItemSorter; |
|
0 commit comments