• Resolved verymary

    (@verymary)


    I would like to change the position of the form that gets displayed in WooCommerce.
    In the woocommerce.addon.php file I found this line:

    // Addon display
    add_action(‘woocommerce_before_add_to_cart_button’, array(&$this, ‘display_form’), 10);

    I would like to change the position to: ‘woocommerce_before_single_product_summary’

    When I try, the form gets displayed on the right place but the calculation does not work anymore. How can I disconnect the form from the add_to_cart_button?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @verymary

    The url provided (https://climaterebels.org/product/offset-your-car-emission/) is password protected.

    Best regards.

    Thread Starter verymary

    (@verymary)

    The password is WooCom19

    Plugin Author codepeople

    (@codepeople)

    Hello @verymary

    I’ve tested your form, and the equations are working fine. Please, look the screenshot below:

    Best regards.

    Thread Starter verymary

    (@verymary)

    Yes, the form works but as I stated, I want to change the position of the form from

    add_action(‘woocommerce_before_add_to_cart_button’, array(&$this, ‘display_form’), 10);

    to

    add_action(‘woocommerce_before_single_product_summary’, array(&$this, ‘display_form’), 10);

    —> putting the form in another position does not work, how do I have to customize the woocommerce.addon.php file? Now it’s connected to the add_to_cart_button which does not make sense…

    Plugin Author codepeople

    (@codepeople)

    Hello @verymary

    The form’s position depends on the structure of the template used by your website. The form must be loaded into a <form> tag. Usually the themes call the hook: “woocommerce_before_add_to_cart_button” inside a form tag with the “add to cart” button, but I don’t know if your theme is calling the “woocommerce_before_single_product_summary” hook into the form too.

    Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘change position of WooCommerce Addon display’ is closed to new replies.