我正在尝试获取以下代码:
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>";
}
输入一个短代码,这样我就可以用这个按钮了,我需要它。我尝试的每件事都会引发错误或417个预期失败。有人能帮帮我吗?
谢斯韦恩