ResolvedProduct Add-on Action

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #25789
    ReactiveLoop
    Participant

    Hello! 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 🙂

    #25796
    Althemist
    Keymaster

    Hello 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,
    Dimitar

    #25799
    ReactiveLoop
    Participant
    This reply has been marked as private.
    #25813
    Althemist
    Keymaster

    Hi ReactiveLoop,

    I understand. I’ll ask our CTO and lead developer Alex to step in and give you some directions.

    Regards,
    Dimitar

    #25832
    Alex
    Keymaster

    Hi 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

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register