• Resolved eclev91

    (@eclev91)


    We’re using wcshipping_packing_list_html to filter the contents of the packing slip you can generate with this plugin. However, from that filter, you only have access to the HTML and the order ID.

    Looking in the packing slip generation logic, there is information leveraged that can’t be obtained from the order ID without using the Loader class from this plugin. For example, information about shipments or labels purchased. That information is used to generate the original HTML, but I can’t access it from my filter. The Loader class is not registered as a singleton, so I can’t get a copy of it. It loads a huge number of instances of other classes, all weirdly codependent, that would be helpful in creating our own HTML.

    At a minimum, could that Loader be registered using a singleton pattern so we can grab the instance from our own code?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support LovingBro (woo-hc)

    (@lovingbro)

    Hi @eclev91,

    Thanks for taking the time to explain what you are trying to achieve here. I can see you are customizing the packing slip output using the wcshipping_packing_list_html filter and have noticed that only the HTML and order ID are available, while other shipment related data used internally by the plugin is not easily accessible.

    At the moment, the wcshipping_packing_list_html filter is intentionally limited to modifying the generated HTML output. The internal shipment and label data you referenced are handled within the plugin’s internal classes during generation, and they are not currently exposed through that filter or a public API. Because of this, accessing those objects directly, such as the Loader instance or the related classes it initializes, is not something that is supported externally.

    If you need additional shipment or label information, you may still be able to retrieve some related data using the order ID via standard WooCommerce order methods, for example using wc_get_order() and inspecting the order items and metadata. That said, the full shipment objects used internally by WooCommerce Shipping are not currently exposed in a way that can be accessed from custom code outside the plugin.

    Your suggestion about registering the Loader class as a singleton or exposing more structured data for packing slip customization is a thoughtful one. Since this would involve a change to how the plugin exposes its internal data, the best path would be to submit it as a feature request so the development team can review it.

    You can share that request here: https://woocommerce.com/feature-requests/shipping/. If you need further support, feel free to let us know.

    Plugin Support Kay U a11n

    (@kingsleyinfo)

    Thanks for reaching out and for your patience while we looked into this! I really appreciate you taking the time to report this — it genuinely helps us improve.

    I’ll go ahead and mark this thread as resolved for now. If anything changes on your end or you need further assistance down the road, feel free to start a new thread anytime — we’re always happy to help!

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.