I get this error when trying to render the product price before the main content on the page.
Fatal error: Uncaught Error: Call to a member function get_price_html() on string in /wp-content/plugins/woocommerce/templates/single-product/price.php:27
Here is my code:
//the remove action works fine
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 10);
//this breaks it
add_action('woocommerce_before_main_content', 'woocommerce_template_single_price', 40);
I assume that because I'm trying to get the price before the main content I need to make sure the global $product
is loaded.
How would I ensure global $product
is loaded?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire