Skip to content

Instantly share code, notes, and snippets.

@Tjobbe
Created October 12, 2017 09:21
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 Tjobbe/5e035b231b30f41608f00962cb823d99 to your computer and use it in GitHub Desktop.
Save Tjobbe/5e035b231b30f41608f00962cb823d99 to your computer and use it in GitHub Desktop.
<?php
/**
* The template for displaying product content in the single-product.php template
*
* This template can be overridden by copying it to yourtheme/woocommerce/content-single-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 3.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
global $product;
?>
<!--content-single-product.php tjobbe-->
<div id="product-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="row product-main">
<div class="col-md-8 col-lg-9 single-product-attributes">
<div class="product-info">
<div class="bnbm-messages">
<?php
/**
* woocommerce_before_single_product hook
*
* @hooked wc_print_notices - 10
*/
do_action( 'woocommerce_before_single_product' );
if ( post_password_required() ) {
echo get_the_password_form();
return;
}
?>
</div>
<!-- .bmbn-messages -->
<div class="row">
<div class="col-sm-5">
<?php woocommerce_show_product_images(); ?>
</div>
<!-- .col -->
<div class="col-sm-7">
<div class="product-name"><?php echo bnbm_woo_get_field( 'product_name' ); ?></div>
<div class="product-SKU"><?php echo bnbm_woo_get_field( 'sku' ); ?></div>
<?php echo bnbm_shipping_class_message($product); ?>
<div class="product-desc"><?php echo bnbm_woo_get_field( 'description' ); ?></div>
<div class="product-stock">
<div class="availability">
<?php echo bnbm_woo_get_field( 'stock_status' ); ?>
</div>
<div class="stock-qty">
<?php echo bnbm_woo_get_field( 'stock_qty' ); ?>
</div>
</div>
<!-- .product-stock -->
</div>
<!-- .col -->
</div>
<!-- .row -->
</div>
<!-- .product-info -->
</div>
<div class="col-md-4 col-lg-3 col-xs-12 col-add-to-cart">
<div class="add-to-cart" style="padding:10px 10px 5px 10px; margin-bottom: 30px; background: #F4F3F9;">
<h4>Quantity selected:</h4>
<div class="cart-action">
<form method="post" enctype="multipart/form-data">
<div class="input-group spinner">
<input type="text" class="form-control" step="1" min="1" max="253" name="quantity" value="1" title="Qty">
<div class="input-group-btn-vertical">
<button class="btn btn-default" type="button"><i class="fa fa-caret-up"></i></button>
<button class="btn btn-default" type="button"><i class="fa fa-caret-down"></i></button>
</div>
</div>
<input type="hidden" name="add-to-cart" value="<?php echo esc_attr( $product->id ); ?>">
<button type="submit" class="single_add_to_cart_button btn btn-cart">Add to cart</button>
</form>
</div>
<!-- .cart-action -->
<div class="price-block">
<div class="product-price">
<?php echo bnbm_woo_get_field( 'price' ); ?>
</div>
<!-- .product-price -->
<div class="vat"><?php echo bnbm_price_suffix(); ?></div>
</div>
<!-- .price-block -->
<p>Price shown above is per <em style="text-decoration: underline; font-weight: bold;" title="The unit quantity is described under the product code at the top of this page">unit</em>.</p>
<?php if ( $discounts = bnbm_woo_pricing_rules() ) : ?>
<h4 class="discount-head" style="color:red;">Cheaper when buying more!</h4>
<p>Discounts will be calculated after adding to the cart.</p>
<div class="product-price-table">
<ul class="list-group">
<li class="list-group-item list-item-head">
<div class="product-qty-head">
Quantity
</div>
<div class="product-price-head">
Price per unit
</div>
</li>
<li class="list-group-item list-item-head">
<div class="product-bulk-qty">
1+
</div>
<div class="product-bulk-price">
<?php echo bnbm_woo_get_field( 'price' ); ?>
</div>
</li>
<?php foreach ( $discounts as $key => $discount_obj ) : ?>
<li class="list-group-item list-item-head">
<div class="product-bulk-qty">
<?php echo $discount_obj->qty; ?>
</div>
<div class="product-bulk-price">
<?php echo $discount_obj->price; ?>
</div>
</li>
<?php endforeach; ?>
</ul>
<!-- .list-group -->
</div>
<!--h4 style="color: red;">Larger quantity discounts?</h4>
<p>Ordering a large quantity and want a better price? Call us on 01295 788522 - we might just be able to help!</p-->
<!-- .product-price-table -->
<?php endif; ?>
</div>
<!-- .add-to-cart -->
</div>
<!-- .col.cart-block -->
<div class="col-sm-12 col-md-8 col-lg-9 col-product-tabs">
<?php bnbm_woo_product_tabs(); ?>
</div>
<!-- .col.product-tabs -->
<?php woocommerce_upsell_display(); ?>
</div>
<!-- .product-main -->
<div class="product-secondary">
<?php woocommerce_output_related_products(); ?>
</div>
<!-- .product-secondary -->
</div>
<!-- #product-<?php the_ID(); ?> -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment