Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('woocommerce_after_add_to_cart_button', 'display_bulk_discount_table', 29);
- function display_bulk_discount_table() {
- global $post, $product;
- $array_rule_sets = get_post_meta($post->ID, '_pricing_rules', true);
- if ($array_rule_sets && is_array($array_rule_sets) && sizeof($array_rule_sets) > 0){
- $tempstring .= '<table cellspacing="0" class="group_table">';
- $tempstring .= '<thead>
- <tr>
- <th colspan="2"><a href="#" class="my_bulk_table">Purchase more? Click here to see ... </a></th>
- </tr>
- <tr class="bulk_row" style="display:none">
- <th scope="col" id="">Quantity</th>
- <th scope="col" id="">Price</th>
- </tr>
- </thead><tbody>';
- foreach($array_rule_sets as $pricing_rule_sets)
- {
- foreach ( $pricing_rule_sets['rules'] as $key => $value ) {
- $tempstring .= '<tr class="bulk_row" style="display:none">';
- $tempstring .= '<td class="tdqty">'.$pricing_rule_sets['rules'][$key]['from']."- ".$pricing_rule_sets['rules'][$key]['to']."</td>";
- $tempstring .= '<td class="price"><span class="amount">$'.$pricing_rule_sets['rules'][$key]['amount']."</span></td>";
- $tempstring .= '</tr>';
- }
- }
- $tempstring .= "</tbody></table>";
- echo $tempstring;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement