Created
July 3, 2024 20:29
-
-
Save kilbot/17c1740a4771b3ded2ef48d900fa56e6 to your computer and use it in GitHub Desktop.
WooCommerce Bottle Deposit Plugin REST API integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add this to your theme's functions.php file to save the bottle deposit on the order. | |
*/ | |
function woocommerce_pos_save_order( $order, $request, $creating ) { | |
global $WooCommerce_Bottle_Deposit; | |
if ( isset( $WooCommerce_Bottle_Deposit ) && class_exists( 'WooCommerce_Bottle_Deposit_Admin' ) ) { | |
$wc_bottle_deposit_admin = new WooCommerce_Bottle_Deposit_Admin( $WooCommerce_Bottle_Deposit->get_plugin_name(), $WooCommerce_Bottle_Deposit->get_version() ); | |
$wc_bottle_deposit_admin->handle_admin_orders( $order->get_id() ); | |
} | |
} | |
add_action( 'woocommerce_rest_insert_shop_order_object', 'woocommerce_pos_save_order', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment