Skip to content

Instantly share code, notes, and snippets.

@wpweb101
Last active June 27, 2018 13:34
Show Gist options
  • Select an option

  • Save wpweb101/3e3f54aa990c833597f2a655161ae017 to your computer and use it in GitHub Desktop.

Select an option

Save wpweb101/3e3f54aa990c833597f2a655161ae017 to your computer and use it in GitHub Desktop.
WooCommerce PDF Voucher - Recipient details not showing on variable product with Jupiter theme
<?php
/*
* Jupiter (version 5.6) theme have overide tempalte called "variation-add-to-cart-button.php".
*
* Path: jupiter/woocommerce/singe-product/add-to-cart/variation-add-to-cart-button.php
*
* PDF Voucher using "woocommerce_before_add_to_cart_button" action which is provided by WooCommerce but jupiter removed that.
* That's why on variable product it's not showing recipient details
*
* To resolve it, replace existing code with following code in variation-add-to-cart-button.php file
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
global $product;
?>
<div class="woocommerce-variation-add-to-cart variations_button">
<?php do_action( 'woocommerce_before_add_to_cart_button' ); ?> <!-- This is the WooCommerce action but jupiter have removed it -->
<?php if ( ! $product->is_sold_individually() ) : ?>
<?php woocommerce_quantity_input( array( 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : 1 ) ); ?>
<?php endif; ?>
<button type="submit" class="single_add_to_cart_button shop-skin-btn shop-flat-btn alt"><?php Mk_SVG_Icons::get_svg_icon_by_class_name(true,'mk-moon-cart-plus'); ?><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
<input type="hidden" name="add-to-cart" value="<?php echo absint( $product->id ); ?>" />
<input type="hidden" name="product_id" value="<?php echo absint( $product->id ); ?>" />
<input type="hidden" name="variation_id" class="variation_id" value="0" />
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment