ResolvedProduct Add-on Action
Tagged: priority, Product Add-on
- This topic has 4 replies, 3 voices, and was last updated 3 years, 2 months ago by
Alex.
- AuthorPosts
- September 17, 2020 at 2:10 pm #25789
ReactiveLoop
ParticipantHello! I want to change the priority of the display product add-on function in order to display the add-on further down the template. (the product add-on is created on the product, not as a global add-on)
I tried removing the action in the content-single-product.php by using:
remove_action('woocommerce_before_add_to_cart_button', array('Lafka_Product_Addon_Display','display'),10);
and then readding the function with a higher priority, but it doesn’t seem to do the trick.Can you please help change the function priority to 99?
Thank you 🙂
September 17, 2020 at 3:35 pm #25796Althemist
KeymasterHello ReactiveLoop,
I am afraid that would not be possible, as the addons are part of the add to cart form. They can’t be outside the form.
Regards,
DimitarSeptember 17, 2020 at 3:44 pm #25799ReactiveLoop
ParticipantThis reply has been marked as private.September 18, 2020 at 9:07 am #25813Althemist
KeymasterHi ReactiveLoop,
I understand. I’ll ask our CTO and lead developer Alex to step in and give you some directions.
Regards,
DimitarSeptember 18, 2020 at 4:48 pm #25832Alex
KeymasterHi ReactiveLoop,
You can not add it from outside of Lafka_Product_Addon_Display class, because of how the display() method is written. It uses $this and the action must be added from Lafka_Product_Addon_Display in order to use $this as a reference. Try to use it from outside and you will see the error in the log.
What you can do is add one more method like reposition_display_for_variable_product() . Look at how this is done and adapt it for your needs.
Regards,
Alex - AuthorPosts
You must be logged in and have valid license to reply to this topic.