Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaupoit/8b51ba528109d6cdd9eab5dd104f242e to your computer and use it in GitHub Desktop.
Save gaupoit/8b51ba528109d6cdd9eab5dd104f242e to your computer and use it in GitHub Desktop.
woocommerce_process_product_meta_simple usage sample
<?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