• In our woocommerce website, orders are also created using the woocommerce APi from another website. We don’t want users form those orders to be added to the referral candy mailing list. Is there a way to do so? Like option to exclude orders with specific meta key?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey there,

    We’ve replied to the concern via your support ticket, but for future reference:
    You would need to edit the ReferralCandy plugin, and edit the file called includes/class-wc-referralcandy-integration.php.

    On line 163, you will find the function called rc_submit_purchase, you need to replace the contents with the following snippet:

    public function rc_submit_purchase($order_id) {
        $wc_order = new WC_Order($order_id);
        $meta_key = 'change_this_to_meta_key';
        $meta_value = $wc_order->get_meta($meta_key, true, 'view');
        if ($meta_value == 'skip_if_meta_value_is_equal_to_this') {
            return;
        } else {
            $rc_order = new RC_Order($order_id, $this);
            $rc_order->submit_purchase();    
        }
    }

    Please make sure to modify the $meta_key value, and skip_if_meta_value_is_equal_to_this to the actual values that you would be using. If you have any more questions, you can continue the discussion with Tomas. Cheers!

    Thread Starter javeedemvigo

    (@javeedemvigo)

    Thanks for the response and I appreciate your effort.
    But, I don’t want to edit the plugin files as updating the plugin will undo all changes? Will you be able incorporate an option to add a meta key for excluding orders in the plugins settings page? I know I going too far by asking this. But our client needs plugin to keep updated always.

    • This reply was modified 4 years, 3 months ago by javeedemvigo.

    @javeedemvigo ,

    It is possible to incorporate the changes on the actual plugin. Could you provide us more information re: the use case of skipping the orders from API? e.g. where are the orders coming from, what is the reason for not sending the orders with the meta key to ReferralCandy, etc. This is just to help us understand better, and provide a better experience once we do incorporate the feature.

    Cheers,
    Jason

    Thread Starter javeedemvigo

    (@javeedemvigo)

    Again thanks. We want to skip orders coming from third parties. i.e our client has some other partners who would like to sell our products from their website and their orders are created in our website using woocommerce API. Since their users don’t want to be added to referal candy, we want skip those orders. Also in future we might have many other partners who would like to sell our products like this. So we may want to skip those partners orders also.

    • This reply was modified 4 years, 3 months ago by javeedemvigo.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exclude mails for certain orders’ is closed to new replies.