Okay
  Public Ticket #3449487
Remove copy_data action
Closed

Comments

  •  3
    Nicholas started the conversation

    Hi there,

    We need to prevent the copy_data action hook from running when a subaccount is created as this is overriding our custom subaccount shipping fields data.

    We have tried:

    remove_action('b2bking_after_subaccount_created', array($b2bking_public, 'b2bking_copy_data'), 10, 1);

    This is not working however.

    Please advise.

    Nick

    Attached files:  Screenshot 2023-09-01 at 13.52.06.png
      Screenshot 2023-09-01 at 13.51.58.png
      Screenshot 2023-09-01 at 13.51.52.png

  •  2,218
    WebWizards replied

    Hi Nick,

    I looked into this and you should be able to remove that by adding this PHP code snippet to your site:

    global $b2bking_plugin;
    remove_action('b2bking_after_subaccount_created', array($b2bking_plugin, 'b2bking_copy_data'), 10, 1);
    add_action('plugins_loaded', function(){
        global $b2bking_plugin;
        remove_action('b2bking_after_subaccount_created', array($b2bking_plugin, 'b2bking_copy_data'), 10, 1);
    });
    

    I've tested it on my local site and it is working in my tests,


    Kind regards,

    Stefan

  •  3
    Nicholas replied

    Hi Stefan,

    This has done the trick, thank you for your help.

    Nick