Skip to content

Instantly share code, notes, and snippets.

@cubehrends
Last active May 17, 2021 15:25
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 cubehrends/d3af852e064acc97f23e1efdb6610074 to your computer and use it in GitHub Desktop.
Save cubehrends/d3af852e064acc97f23e1efdb6610074 to your computer and use it in GitHub Desktop.
Processing WooCommerce Meta Infos
<?php
add_action( 'woocommerce_process_product_meta', 'wdt_process_delivery_time_fallback', 10, 2 );
function wdt_process_delivery_time_fallback( $id, $post ){
$dtf_id = $_POST['delivery_time_fallback'];
if( $dtf_id === '' ) {
delete_post_meta( $id, '_delivery_time_fallback' );
} else {
update_post_meta( $id, '_delivery_time_fallback', $dtf_id );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment