如何添加货币切换器下拉菜单旁边的添加到购物车按钮在单一产品页面


How to add Currency Switcher Drop down menu next to Add to Cart Button on Single Product page?

嗨,我有这个网站www.gallery5designs.com,这是样品的链接http://gallery5designs.com/product/necklace-18k-white-gold-plating-aaa-cubic-zerconia/

我有一个名为"WooCommerce货币切换器"的插件,它可以在任何地方显示货币切换选项。但问题是。。该插件只提供了一个嵌入任何位置或小部件的快捷代码,但我希望货币切换器出现在网上,添加到购物车按钮。我在这个网站上使用贝瑟姆的儿童主题。有人能帮我吗?

下面的代码输出单个产品页面上添加到购物车按钮附近的货币转换器表单。但是,您需要根据需要通过css对其进行样式设置。此代码需要放在主题/子主题的functions.php文件中。

add_action('woocommerce_single_product_summary','woocs_custom_location',35);
function woocs_custom_location(){
    $plugin_var= "woocommerce-currency-switcher";
    if (in_array( $plugin_var.'/index.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ){
        echo(do_shortcode('[woocs]'));
    }
}

我已经在我的wooccommerce设置中尝试并测试了这一点。希望这能有所帮助。