Created
September 29, 2016 04:06
-
-
Save stevenhoney/6759e709b4218cdd97ac0d144055a5fe to your computer and use it in GitHub Desktop.
Simple plugin in to display a custom field from a woocommerce product named delivery_time_frame on product pages
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 | |
/* | |
Plugin Name: WooCommerce Delivery Time Frame. | |
Plugin URI: http://stevenhoney.com | |
Description: Proof of concept not tested beyond a single localhost install, copy at your own risk. | |
Version: 1.0 | |
Author: Steve Honey | |
Author URI: http://stevenhoney.com | |
*/ | |
add_action( 'woocommerce_after_single_variation', 'woocommerce_after_single_variation_display_delivery_time_frame' ); | |
function woocommerce_after_single_variation_display_delivery_time_frame(){ | |
$time_frame = get_post_meta( get_the_ID(), 'delivery_time_frame', true ); | |
if( $time_frame ){ | |
echo '<p>Target Delivery: ' . $time_frame . '</p>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment