Created
June 18, 2020 01:39
-
-
Save gaupoit/8b51ba528109d6cdd9eab5dd104f242e to your computer and use it in GitHub Desktop.
woocommerce_process_product_meta_simple usage sample
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_action( 'woocommerce_process_product_meta_simple', 'save_options' ); | |
function save_options( $product_id ) { | |
$keys = array( | |
'_ppwp_woo_protected_post', | |
'_ppwp_woo_usage_limit', | |
'_ppwp_woo_expiration', | |
'_ppwp_woo_custom_text', | |
'_ppwp_woo_protection_type', | |
); | |
foreach ( $keys as $key ) { | |
if ( isset( $_POST[ $key ] ) ) { // phpcs:ignore | |
update_post_meta( $product_id, $key, $_POST[ $key ] ); // phpcs:ignore | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment