Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Add expiry date to product page
*/
function prefix_show_expiration_period() {
$product_id = get_the_ID();
$expires_after_value = get_post_meta( $product_id, 'wcmo_product_expires_after_value', true );
$expires_after_period = get_post_meta( $product_id, 'wcmo_product_expires_after_period', true );
if( $expires_after_value && $expires_after_period ) {
echo 'Expires after ' . $expires_after_value . ' ' . $expires_after_period;
}
}
add_action( 'woocommerce_single_product_summary', 'prefix_show_expiration_period', 15 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment