Create label by php activation
-
use PostNLWooCommerce\Main; $main = Main::instance(); $order_id = 1234; $label_params = array( "action" => "postnl_order_save_form", "order_id" => $order_id, "postnl_id_check" => "", "postnl_insured_shipping" => "", "postnl_return_no_answer" => "", "postnl_signature_on_delivfooery" => "", "postnl_only_home_address" => "", "postnl_letterbox" => "yes", "postnl_num_labels" => "", "postnl_create_return_label" => "", "postnl_position_printing_labels" => "top-left", "postnl_label_nonce" => wp_create_nonce('postnl_download_label_nonce'), "woocommerce-login-nonce" => "", "_wpnonce" => "", "woocommerce-reset-password-nonce" => "" ); $main->shipping_order->save_meta_value($order_id, $label_params);
Hi I would like to automatically create a label for a certain order in PHP. If I add the following code in functions.php I get the error saying “$main->shipping_order” is NULL, what am I doing wrong?
Is it possible to create a label for a certain order in PHP, and how so?
- The topic ‘Create label by php activation’ is closed to new replies.