Skip to content

Instantly share code, notes, and snippets.

@kilbot
Created August 19, 2017 11:00
Show Gist options
  • Save kilbot/0f2af68b9c672e59aedc2b9d44459108 to your computer and use it in GitHub Desktop.
Save kilbot/0f2af68b9c672e59aedc2b9d44459108 to your computer and use it in GitHub Desktop.
Making Cost of Goods plugin compatible with the WC REST API
<?php
// add the code below to your functions.php file
function my_custom_insert_shop_order_object( $order ) {
if( function_exists('wc_cog') ) {
$WC_COG = wc_cog();
$WC_COG->set_order_cost_meta( $order->get_id() );
}
}
add_action('woocommerce_rest_insert_shop_order_object', 'my_custom_insert_shop_order_object');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment