Despite that my PHP knowledge is very scarce I've managed to add some elements under the add-to-cart button in my installation of Woocommerce with the function:
add_action( 'woocommerce_after_add_to_cart_button', 'astra_add_woocommerce_payments', 97 );
function astra_add_woocommerce_payments()
I'd like to also add a small currency converter calculator widget using the same function, if possible, but my Google-fu hasn't returned useful results. Do I need to access the source code of the plugin? is there an easy way to do it? where do I start?
Hope to improve my programming skills bit by bit with your help guys. Thanks for your attention.
Despite that my PHP knowledge is very scarce I've managed to add some elements under the add-to-cart button in my installation of Woocommerce with the function:
add_action( 'woocommerce_after_add_to_cart_button', 'astra_add_woocommerce_payments', 97 );
function astra_add_woocommerce_payments()
I'd like to also add a small currency converter calculator widget using the same function, if possible, but my Google-fu hasn't returned useful results. Do I need to access the source code of the plugin? is there an easy way to do it? where do I start?
Hope to improve my programming skills bit by bit with your help guys. Thanks for your attention.
Your plugin for the converter supports shortcodes, so this is a good starting point. Everything should be as simple as using this code:
add_action( 'woocommerce_after_add_to_cart_button', 'astra_add_woocommerce_payments', 97 );
function astra_add_woocommerce_payments(){
echo do_shortcode( '[currency_converter_calculator lg=”en” tz=”0″ fm=”EUR” to=”USD” st=”info” bg=”FFFFFF”][/currency_converter_calculator]' );
}
You probably want to wrap the shortcode result inside a div
or something to size it properly for your add to cart area.
You can also take the "register sidebar" road and create a proper sidebar/widget area so you can control it from the backend, in that case take a look at this.