Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@alexv66
Last active May 22, 2020 09:16
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 alexv66/fa81ff21080564fa3a0a94c71d414d7c to your computer and use it in GitHub Desktop.
Save alexv66/fa81ff21080564fa3a0a94c71d414d7c to your computer and use it in GitHub Desktop.
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* @var string $header_html
* @var array $table_header
* @var array $rows
* @var string $footer_html
*/
global $product;
$product_id = $product->get_id();
?>
<div class='clear'></div>
<div class="bulk_table">
<div class="wdp_pricing_table_caption"><?php echo $header_html; ?></div>
<table class="wdp_pricing_table">
<thead>
<tr>
<?php foreach ( $table_header as $label ): ?>
<td><?php echo $label ?></td>
<?php endforeach; ?>
<td>Action</td>
</tr>
</thead>
<tbody>
<?php foreach ( $rows as $row ): ?>
<tr>
<?php foreach ( $row as $html ): ?>
<td><?php echo $html ?></td>
<?php endforeach; ?>
<?php $elements = explode( "-", $row['qty']);
$qty = trim($elements[0]);
$link = "?add-to-cart=$product_id&quantity=$qty";
echo "<td><a href='$link'>BUY $qty now!</a></td>";
?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<span class="wdp_pricing_table_footer"><?php echo $footer_html; ?></span>
<br>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment