Support » Plugin: Product Addons for Woocommerce » Unable to change the position of the CPA form

  • Resolved MisterR

    (@mister_r)


    Hello!

    Product type is Variable Subscription, the CPA form is added on ‘woocommerce_before_add_to_cart_button’ action. We want to put it above the variations list.

    For some reason the following code doesn’t work. Any idea why?

    remove_action('woocommerce_before_add_to_cart_button', array('WCPA_Front_End', 'before_add_to_cart_button'));
    add_action('woocommerce_before_variations_form', array('WCPA_Front_End', 'before_add_to_cart_button'));

    It adds the second instance of the form above the variations list, but doesn’t remove it from the original position.

    • This topic was modified 1 year, 2 months ago by MisterR.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support ashin_acowebs

    (@ashinacowebs)

    Hi,
    Try this code:

    add_filter('wcpa_display_hooks', function ($hooks) {
        $hooks["fields"] = ["woocommerce_before_variations_form", 10];
        $hooks["price_summary"] = ["woocommerce_before_add_to_cart_button", 10];
        return $hooks;
    });

    Thank you

    Thread Starter MisterR

    (@mister_r)

    ashin_acowebs,
    It does nothing. There’s no “wcpa_display_hooks” filter in the newest plugin version.

    Plugin Support ashin_acowebs

    (@ashinacowebs)

    Hi,

    Sorry, if you are using the Free version there is no such an option to change the position of the addons. It is available with Pro version only as of now.

    But will add this feature to the Free version also by the next update.

    Thank you.

    Thread Starter MisterR

    (@mister_r)

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Unable to change the position of the CPA form’ is closed to new replies.