Giter Site home page Giter Site logo

Comments (6)

rawdreeg avatar rawdreeg commented on August 15, 2024

Hi @sanesh-acowebs,

Can you provide more details on what you're trying to do? The purchase event is triggered when the order is placed or checked out. Do you want to change when this happens?

from facebook-for-woocommerce.

sanesh-acowebs avatar sanesh-acowebs commented on August 15, 2024

Hi, We are using the deposit plugin for partial payment. So we have the option to pay the full amount or a partial amount. The issue that we are facing is that when a customer pays the full amount (as a normal order) its purchase events are correctly registered with Facebook. But when we try to make a partial payment, it is not registered. When we try to pay using partial payment, a new custom order status "partially paid" is used for tracking. So want to know whether there are any filters available to add custom order status in the purchase event.  

from facebook-for-woocommerce.

rawdreeg avatar rawdreeg commented on August 15, 2024

Thanks for clarifying. I looked into this, and we only trigger the purchase event post-checkout with a fallback that runs on the thankyou_page. There are no filters to trigger this event at the moment.

from facebook-for-woocommerce.

sanesh-acowebs avatar sanesh-acowebs commented on August 15, 2024

Thanks for your reply. Can you give a little more clarity about the changes required. Currently, we are only changing the order status to "partially paid" other than normal "processing or completed". 

from facebook-for-woocommerce.

rawdreeg avatar rawdreeg commented on August 15, 2024

We only trigger a purchase event once the checkout is completed. If you want a purchase to be sent when the status changes, this might require some custom logic. For example:

add_action('woocommerce_order_status_changed', 'send_purchase_event', 10, 3);

function send_purchase_event($order_id, $old_status, $new_status) {
    $order = wc_get_order($order_id);
    if ( ! $order ) {
        return;
    }
    
    if ( 'your new status' === $new_status ) {
        if ( function_exists( 'facebook_for_woocommerce' ) ) {
            facebook_for_woocommerce()->get_integration()->events_tracker->inject_purchase_event($order_id);
        }
    }
}

However, I recommend against something like this as it uses the plugin's internal code, which may be subject to change. You can also add a feature request for this, and our team will review: https://woocommerce.com/feature-requests/facebook/

from facebook-for-woocommerce.

sanesh-acowebs avatar sanesh-acowebs commented on August 15, 2024

We have created a new feature request on the shared link. And also we will check the shared code and share our comments. Thanks.

from facebook-for-woocommerce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.