Skip to content

Instantly share code, notes, and snippets.

@bhavik-kiri
Last active November 6, 2017 05:12
Show Gist options
  • Save bhavik-kiri/d9a0a680b1118e34faa41558fa895a30 to your computer and use it in GitHub Desktop.
Save bhavik-kiri/d9a0a680b1118e34faa41558fa895a30 to your computer and use it in GitHub Desktop.
<?php
/**
* Simple custom product
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
global $product;
do_action( 'gift_card_before_add_to_cart_form' ); ?>
<form class="gift_card_cart" method="post" enctype='multipart/form-data'>
<table cellspacing="0">
<tbody>
<tr>
<td >
<label for="gift_card_amount"><?php echo __( "Amount", 'wcpt' ); ?></label>
</td>
<td class="price">
<?php $get_price = get_post_meta ( $product->get_id(), '_gift_card_price' );
$price = 0;
if ( isset( $get_price[0] ) ) {
$price = wc_price( $get_price[0] ) ;
}
echo $price;
?>
</td>
</tr>
</tbody>
</table>
<button type="submit" name="add-to-cart" value="<?php echo esc_attr( $product->get_id() ); ?>" class="single_add_to_cart_button button alt"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
</form>
<?php do_action( 'gift_card_after_add_to_cart_form' ); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment