Untitled

 avatar
unknown
plain_text
a year ago
834 B
5
Indexable
add_action('woocommerce_after_add_to_cart_button', function(){

	global $post;
	$post_id = $post->ID;
	$product = wc_get_product($post_id);

	if( $product->is_type( 'simple' )){
		$is_enabled = get_post_meta($post_id, 'b2bking_show_pricing_table', true);
		if (!$product->is_purchasable()){
			$is_enabled = 'no';
		}
		if ($is_enabled !== 'no'){
			$user_id = get_current_user_id();
			$currentusergroupidnr = b2bking()->get_user_group($user_id);

			$price_tiers = get_post_meta($post_id, 'b2bking_product_pricetiers_group_'.$currentusergroupidnr, true);
			if (empty($price_tiers)){
				$price_tiers = get_post_meta($post_id, 'b2bking_product_pricetiers_group_b2c', true );
			}

			if (!empty($price_tiers) && strlen($price_tiers) > 1 ){
				// show title here
				?>
				<br>
				<h3>Table Title</h3>
				<?php
			}
		}
	}
}, 5);
Leave a Comment