• Resolved Sem

    (@wpdomein)


    Hi there,

    I’ve enabled HPOS mode on a clients site, however we’re facing some issues now. We have a couple of custom bulk actions registered. But the DHL plugin seems to capture them.

    class-dhlpwc-controller-admin-order.php:23

    if ($settings_service->is_hpos_enabled()) {
    add_filter('handle_bulk_actions-woocommerce_page_wc-orders', array($this, 'handle_wc_bulk_actions'), 10, 2);
    }

    class-dhlpwc-controller-admin-order.php:115

        public function handle_wc_bulk_actions($redirect_to, $action)
    {

    switch ($action) {
    case 'dhlpwc_download_label':
    $this->download_label();
    break;
    case 'dhlpwc_download_labels':
    $this->download_multiple_labels();
    break;
    case 'dhlpwc_print_labels':
    $this->print_multiple_labels();
    break;
    default:
    $bulk_parameters = $this->split_bulk_parameters($action);

    $this->create_multiple_labels($bulk_parameters['size'], $bulk_parameters['service_options']);
    break;
    }
    }

    I think this is caused by the ‘default’ statement. The plugin only seems to use this function on HPOS mode, that’s why it wasn’t a problem earlier. I’ve disabled our custom actions for now.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author dennisdhl

    (@dennisdhl)

    Hi Sem,

    Thank you for telling us about your issue. You seem to be right about the location where this issue arrises. For now I’ve created an item on our backlog to resolve this issue.

    As a short term solution, you might want to add an if-statement above this switch to do an early return when the bulk action does not contain our prefix.

            if (substr($action, 0, 6) !== 'dhlpwc') {
    return;
    }

    If you do this, always test changes on a staging or test environment first. You can also wait for us to fix this in an upcoming release.

    Kind regards,
    Dennis van der Hammen
    DHL Plugin Team

    Thread Starter Sem

    (@wpdomein)

    Thanks for picking this up Dennis!

    I’ve updated your snippet to the following:

    if (substr($action, 0, 6) !== 'dhlpwc') {
    return $redirect_to;
    }

    Just returning caused a white screen when executing my custom bulk actions.

    • This reply was modified 5 months, 1 week ago by Sem.
    Plugin Author dennisdhl

    (@dennisdhl)

    Hey Sem,

    Thank you for getting back to me. I’ve updated the mentioned backlog item.

    Kind regards,
    Dennis van der Hammen
    DHL Plugin Team

    Plugin Author dennisdhl

    (@dennisdhl)

    Hi @wpdomein,

    I see that I didn’t follow up on your issue yet. We have resolved the issue in version 2.1.5. From this version on your custom bulk actions will not be intercepted by our code anymore.

    Kind regards,
    Dennis van der Hammen
    DHL Plugin Team

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.