I am trying to get this code:
public function add_request_quote_btn() {
global $product;
$product_id = $product->get_id();
$wc_quote_show_button = get_option('wc_quote_show_button');
$enable_btn = 'no';
if($wc_quote_show_button == 'all' || $wc_quote_show_button == '')
$enable_btn = 'yes';
elseif($wc_quote_show_button == 'out_stock' && !$product->is_in_stock())
$enable_btn = 'yes';
elseif($wc_quote_show_button == 'guest_users' && !is_user_logged_in())
$enable_btn = 'yes';
elseif($wc_quote_show_button == 'logged_in_users' && is_user_logged_in())
$enable_btn = 'yes';
elseif($wc_quote_show_button == 'specific_products'){
$wc_quote_products = get_option('wc_quote_products');
if(!empty($wc_quote_products) && in_array($product_id, $wc_quote_products))
$enable_btn = 'yes';
}
if($enable_btn == 'yes')
{
$wc_quote_button_text = get_option('wc_quote_button_text');
if($wc_quote_button_text == '')
$wc_quote_button_text = __('Request Quote', 'woocommerce');
echo "<button class="open-wc-quote-form single_add_to_cart_button button alt" data-product="'.$product_id.'">'.$wc_quote_button_text.'</button>";
}
into a shortcode so i can put this button wjere i need it. Everything i try throws errors or 417 failed expectation.
Could someone help me out?
Thanks Wayne