Last active
March 31, 2018 11:32
-
-
Save tamarazuk/54cfd7384843fb838294 to your computer and use it in GitHub Desktop.
WooCommerce Admin Custom Order Fields - Allow custom order fields to be accessed by the WooCommerce REST API
This file contains hidden or 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 // only copy this line if needed | |
function sv_wc_api_allow_acof_protected_meta() { | |
add_filter( 'is_protected_meta', 'sv_wc_acof_is_protected_meta', 10, 2 ); | |
} | |
add_action( 'woocommerce_api_loaded', 'sv_wc_api_allow_acof_protected_meta' ); | |
function sv_wc_acof_is_protected_meta( $protected, $meta_key ) { | |
if ( 0 === strpos( $meta_key, '_wc_acof_' ) ) { | |
$protected = false; | |
} | |
return $protected; | |
} |
Just wanted to thank you for this code! Helped out a lot. Appreciate it!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@bobby5892 yes.