Reputation: 33
I'm having an issue with how a plugin is displaying financed prices on a variable product page after a variant is chosen.
Original piece of code:
if (is_product())
{
/**
* Calculate and display installmentes for each child in variation product
*/
add_action('woocommerce_before_single_variation', array($this, 'fswp_variable_installment_calculation'), 99);
}
What's happening is that instead of the financed priced showing underneath the full price, it's showing above it.
I tested both woocommerce_after_single_variation and woocommerce_single_variation but both of those moved the financed price underneath the Add to Cart button rather than underneath the full variant price.
It currently displays like this:
I would like the financed price to display just above the "Em Estoque" message and just underneath the Full Variant Price (in this particular case R$269,90).
When inspected, these are labeled as the following classes:
I partially used this website as somewhat of a guide: https://businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/ although it wasn't of much help as the exact position I'm looking for doesn't seem to be available.
Finally, does anyone know what "position" I should have this loop display in so that it shows underneath the full price?
Link to page: https://mommy.com.br/land
Regards, Jakub.
Upvotes: 0
Views: 384
Reputation: 141
Look for the Woocommerce template fragment where the meta box hooks are called. If you see the last piece of this:
add_action('woocommerce_before_single_variation', array($this, 'fswp_variable_installment_calculation'), 99);
you can see a number 99.. That's the position. If another hook is 20 the it will display that one before. It's just ordered by number.
If you don't know where is it you can just start guessing (assuming the template developer change all of it).
Here you have the default values:
/**
* woocommerce_single_product_summary hook.
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
Upvotes: 0