I am writing a simple WooComerce plugin. This is the first time I work with WordPress so my question may be quite noobish.
The plugin should just provide some additional information about product price, which is approximate price in local currency (based on visitors location).
Pseudo dummy code:
add_action(
'woocommerce_get_price_html',
function append_local_price($content, $product) {
return $content . ' <span class="amount-local-price">Approx. (RSD 3,804)</span>';
},
10,
2
);
Dummy implementation, formatting and other issue aside, since that is not my focus in this question, what is the proper way of hooking into WooCommerce workflow in this case?
Because what I see as a pros of this approach is that you just install plugin and it works, zero configuration. But downsides are html rendering is not easily configurable (css class etc...) and you cannot control when it is applied.
Is some kind of short code more appropriate in this case?
This will require editing the theme in order to get local price shown, right?